以下配置有效,但我有理由从项目根目录移动webpack配置。因此,__dirname
值会发生变化,我需要转到__dirname
的上限。怎么做?
const output_path = isDevelopment ? (__dirname + '/development/devBuild') : (__dirname + '/public');
module.exports = {
entry: {
'open/js/testOpenEntryPoint': './development/source/open/es6/testOpenEntryPoint',
'admin/js/testAdminEntryPoint': './development/source/admin/es6/testAdminEntryPoint'
}
output: {
path: output_path,
filename: '[name].js'
},
// ...
}
答案 0 :(得分:0)
const projectRootDirectory = __dirname + '/../../..';
const output_path = options.isDevelopment ? (projectRootDirectory + '/development/devBuild') : (projectRootDirectory + '/public');
会做的。