简体   繁体   English

规则 'import/no-unresolved' 的生成的故事条目.js 错误

[英]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.

相关问题 与 TS 反应,eslint 错误导入/未解决 - React with TS, eslint error import/no-unresolved JavaScript on Next.js 和 React 导入错误“无法解析模块'../utils/makeId'.eslintimport/no-unresolved 的路径” - JavaScript on Next.js and React import error "Unable to resolve path to module '../utils/makeId'.eslintimport/no-unresolved" eslint 在声明文件上抛出 import/no-unresolved 错误 - eslint throwing import/no-unresolved error on declaration files 错误无法解析模块“html-webpack-plugin”导入的路径/未解决 - error Unable to resolve path to module 'html-webpack-plugin' import/no-unresolved 带有 Eslint 的 Vite.js 上的 Vue 3 — 无法解析模块 eslint 的路径(导入/未解决) - Vue 3 on Vite.js with Eslint — Unable to resolve path to module eslint(import/no-unresolved) 如何在 ESLint 中为导入文件解析“import/no-unresolved”! 对于 javascript 和 nodejs - How to resolve "import/no-unresolved" in ESLint for import files! for javascript and nodejs 如何在Webpack 4中使用eslint的安装来解决导入/无法解决的问题 - how to resolve import/no-unresolved with setup of eslint in webpack 4 无法在 eslint 中解析模块路径(导入/未解析) - Unable to resolve path to module (import/no-unresolved) in eslint 如何从导入“react”中删除未解决的 ESlint 错误 - How to remove ESlint error no-unresolved from importing 'react' ESLint 规则在可用时更喜欢从 index.js 导入? - ESLint rule to prefer import from index.js when available?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM