Webpack:从本地目录加载依赖项

Asq*_*qan 5 npm webpack npm-install

包.json

"dependencies": {
    "axios": "^0.18.0",
    "lodash": "^4.17.5",
    "moment": "^2.22.0",
    "vue": "^2.5.2",
    "vue-router": "^3.0.1",
    "vuex": "^3.0.1",
    "my-module-1": "file:../modules/my-module-1",
    "my-module-2": "file:../modules/my-module-2",
    "my-module-3": "file:../modules/my-module-3"
  },
Run Code Online (Sandbox Code Playgroud)

如果我安装了依赖项,它就成功完成了。但是,在 map 中node_modulesmy-module-x是一个快捷方式,导致 babel-loader 出现奇怪的错误。如果我将我的模块复制粘贴到node modules. 在以前的 webpack 版本中,它们总是被复制。现在使用 webpack 3.6.0。

所以,我的问题是:是否有另一种在 package.json 中定义依赖项的方法,或者一个将模块(从 package.json)从另一个目录复制到node_modules而不创建快捷方式的插件。

Asq*_*qan 3

"dependencies": {
    "my-module": "file:a_map/my-module", 
    // a_map folder is on the same level as this package.json file
}
Run Code Online (Sandbox Code Playgroud)

与设置配合得很好:

Npm (6.12.0)

在此输入图像描述