[英]generated-stories-entry.js error for rule 'import/no-unresolved'
I have added storybook to my Vue project with vue add storybook
.我已使用
vue add storybook
添加到我的 Vue 项目中。
This has added several dependencies to my project, eg in my package.json
I find this among others:这为我的项目添加了几个依赖项,例如在我的
package.json
中,我发现了这个:
"vue": "~2.6.14",
"@storybook/vue": "6.4.19",
"vue-cli-plugin-storybook": "~2.1.0",
"eslint": "~6.8.0",
Now I am trying to run the storybook server with npm run storybook:serve
but I get an error:现在我正在尝试使用
npm run storybook:serve
书服务器,但出现错误:
I have been trying different things, like configuring the 'import/no-unresolved' rule to be off, emitError: false
on the eslist-loader
inside .eslintrc
, skipping the linter plugin in the webpack configuration, etc. Nothing worked and each attempt just produced new errors.我一直在尝试不同的事情,比如将 'import/no-unresolved' 规则配置为关闭,
emitError: false
在 .eslintrc 内的eslist-loader
上,在.eslintrc
配置中跳过 linter 插件等。没有任何效果,每次尝试刚刚产生了新的错误。
Currently I have no explicit es-linter
nor webpack
configuration at all.目前我根本没有明确
es-linter
linter 或webpack
配置。 But if I comment a line inside node_modules/eslint-loader/index.js
like this:但是,如果我像这样在
node_modules/eslint-loader/index.js
注释一行:
// emitter(new ESLintError(messages));
then it all works .然后一切正常。
I don't want to be commenting out lines inside a library, I would like to have a proper solution and understand what is happening.我不想评论图书馆内的行,我想有一个适当的解决方案并了解正在发生的事情。
I found the answer myself.我自己找到了答案。 I had to add the
eslint-plugin-import
package:我不得不添加
eslint-plugin-import
包:
npm install eslint-plugin-import
And add the plugin to the eslint
configuration:并将插件添加到
eslint
配置中:
"plugins": [
"import"
]
For me the suggested answer didn't work, what fix it in the end was to ignore those files in eslint configuration:对我来说,建议的答案不起作用,最终解决它的方法是忽略 eslint 配置中的那些文件:
"ignorePatterns": [
"generated-stories-entry.js",
"storybook-init-framework-entry.js"
],
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.