规则“import/no-unresolved”的 generated-stories-entry.js 错误

发布于 2025-01-13 09:52:40 字数 930 浏览 0 评论 0原文

我已使用 vue add Storybook 将故事书添加到我的 Vue 项目中。

这为我的项目添加了几个依赖项,例如在我的 package.json 中,我发现了以下内容:

"vue": "~2.6.14",
"@storybook/vue": "6.4.19",
"vue-cli-plugin-storybook": "~2.1.0",
"eslint": "~6.8.0",

现在我尝试使用 npm runstorybook:serve 运行故事书服务器但我收到错误:

错误来自Storybook:serve

我一直在尝试不同的事情,例如将 'import/no-unresolved' 规则配置为关闭,eslist-loader< 上的 emitError: false /code> 在 .eslintrc 中,跳过 webpack 配置中的 linter 插件等。没有任何效果,每次尝试都会产生新的错误。

目前我根本没有显式的 es-linter 或 webpack 配置。 但是如果我在 node_modules/eslint-loader/index.js 中注释一行,如下所示:

//emitter(new ESLintError(messages));

然后一切正常

我不想注释掉库内的行,我希望有一个适当的解决方案并了解正在发生的情况。

I have added storybook to my Vue project with vue add storybook.

This has added several dependencies to my project, e.g. in my package.json I find this among others:

"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:

Error from 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.

Currently I have no explicit es-linter nor webpack configuration at all. But if I comment a line inside node_modules/eslint-loader/index.js like this:

// 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

み青杉依旧 2025-01-20 09:52:40

我自己找到了答案。我必须添加 eslint-plugin-import 包:

npm install eslint-plugin-import

并将插件添加到 eslint 配置中:

"plugins": [
    "import"
]

I found the answer myself. I had to add the eslint-plugin-import package:

npm install eslint-plugin-import

And add the plugin to the eslint configuration:

"plugins": [
    "import"
]
瑶笙 2025-01-20 09:52:40

对我来说,建议的答案不起作用,最终解决的方法是忽略 eslint 配置中的这些文件:

"ignorePatterns": [
      "generated-stories-entry.js",
      "storybook-init-framework-entry.js"
    ],

For me the suggested answer didn’t work, what fix it in the end was to ignore those files in eslint configuration:

"ignorePatterns": [
      "generated-stories-entry.js",
      "storybook-init-framework-entry.js"
    ],
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文