首页 > 解决方案 > 如何在纱线中导入本地依赖项

问题描述

我有2个项目:

我正确构建了 ProjectB,然后:yarn link

我在package.jsonProjectA 中添加了依赖项,"ProjectB":"1.0.0" 然后在 ProjectA 根目录中添加yarn link ProjectB

仍然当我尝试导入 ProjectB: import {Stuff} from 'ProjectB' Vuejs 项目的构建失败并出现此错误(这似乎无关,但导入导致它):

 ERROR  Failed to compile with 1 errors 
Module build failed (from ./node_modules/@vue/cli-plugin-eslint/node_modules/eslint-loader/index.js):
Error: No ESLint configuration found.
    at Config.getLocalConfigHierarchy (/nodejs/wrapper_project/vuejs_frontend/node_modules/eslint/lib/config.js:268:39)
    at Config.getConfigHierarchy (/nodejs/wrapper_project/vuejs_frontend/node_modules/eslint/lib/config.js:192:43)
    at Config.getConfigVector (/nodejs/wrapper_project/vuejs_frontend/node_modules/eslint/lib/config.js:299:21)
    at Config.getConfig (/nodejs/wrapper_project/vuejs_frontend/node_modules/eslint/lib/config.js:342:29)
    at processText (/nodejs/wrapper_project/vuejs_frontend/node_modules/eslint/lib/cli-engine.js:181:33)
    at CLIEngine.executeOnText (/nodejs/wrapper_project/vuejs_frontend/node_modules/eslint/lib/cli-engine.js:690:40)
    at lint (/nodejs/wrapper_project/vuejs_frontend/node_modules/@vue/cli-plugin-eslint/node_modules/eslint-loader/index.js:263:17)
    at transform (/nodejs/wrapper_project/vuejs_frontend/node_modules/@vue/cli-plugin-eslint/node_modules/eslint-loader/index.js:237:18)
    at /nodejs/wrapper_project/vuejs_frontend/node_modules/loader-fs-cache/index.js:127:18
    at ReadFileContext.callback (/nodejs/wrapper_project/vuejs_frontend/node_modules/loader-fs-cache/index.js:31:14)
    at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:237:13)

You may use special comments to disable some warnings.
Use // eslint-disable-next-line to ignore the next line.
Use /* eslint-disable */ to ignore all warnings in a file. 

我错过了什么?

这些问题似乎相关:

标签: node.jsvue.jsnpmecmascript-6yarnpkg

解决方案


推荐阅读