我有以下项目结构:
-dist
└ a.js (this is a bundled file)
-src
└ b.js
文件 a.js
function foo (name) {
console.log(name);
}
module.exports = foo;
文件 b.js
const log = require('../dist/a.js');
log('stackoverflow');
我想捆绑 b.js 文件,但我不想在此捆绑包中包含 a.js 文件。因此,当 b.js 被捆绑并且输出写入 dist 文件夹时,b.js(捆绑文件)仍然需要 a.js
我怎么能用 webpack 做到这一点?我认为我应该在 webpack 配置中使用 'externals' 选项,但我找不到非 node_modules 库的示例。