Skip to content

npm run build打包报错TS6504 #420

@HEYUANBAO

Description

@HEYUANBAO

错误内容:
error TS6504: File 'D:/xxxx/src/components/svg-icon/index.vue.js' is a JavaScript file. Did you mean to enable the 'allowJs' option?
The file is in the program because:
Matched by include pattern 'src/**/*' in 'xxxx/tsconfig.json'

tsconfig.json:18:15
18 "include": ["src//*", "src//*.vue"],
~~~~~~~~~~
File is matched by include pattern specified here.

解决过程
在tsconfig.json中添加"allowJs": true,后仍然报错,怀疑是否是缓存原因,将/svg-icon/index.vue改名为/svg-icon/test.vue后报错组件名称仍然为/svg-icon/index.vue,因此判断缓存导致的报错。
接着,我又清理了npm缓存,再次进行打包,还是报错。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions