【发布时间】:2018-03-26 08:56:01
【问题描述】:
我想使用我当前工作目录之外的webpack.config.js。
此外,这个webpack.config.js 不在我当前工作目录的父目录中,它被分隔在另一个位置。
在webpack.config.js 我有要求,比如:
const CircularDependencyPlugin = require('circular-dependency-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
... More requires
在我的 cmd 中,我定位到我的项目目录,当我使用 --config 标志运行 Webpack 时
webpack --config ../path/to/file/webpack.config.js
Webpack 找到并使用了配置文件,但它给出了一个错误,即找不到循环依赖插件。
似乎 Webpack 正在搜索 node_modules 目录,而不是当前工作目录中的 webpack.config.js。
至少我认为是这样,我可能错了。
有什么方法可以让 Webpack 在另一个位置读取配置文件,但仍然在当前工作目录中使用 node_modules?
【问题讨论】:
标签: node.js webpack webpack.config.js