chainWebpack - 如何设置 infrastructureLogging
chainWebpack - how to set infrastructureLogging
我在 vue.config.js
中有 chainWebpack
部分。我
chainWebpack: config => {
// Add "node_modules" alias
config.resolve.alias
.set('node_modules', path.join(__dirname, './node_modules'));
config.devtool('source-map');
// Do not remove whitespaces
config.module.rule('vue')
.use('vue-loader')
.loader('vue-loader')
.tap(options => {
options.compilerOptions.preserveWhitespace = true
return options
})
}
我想包括 infrastructureLogging
部分以将日志记录重定向到 stdout
而不是 stderr
:
module.exports = {
//...
infrastructureLogging: {
stream: process.stdout,
},
};
如何在使用 chainWebpack
部分时做到这一点?
webpack-chain
(由 chainWebpack
使用)似乎不支持 infrastructureLogging
.
的 API
但是,您可以使用 configureWebpack
将该选项传递给 Webpack:
module.exports = {
configureWebpack: {
infrastructureLogging: {
stream: process.stdout,
},
}
}
注意chainWebpack
和configureWebpack
可以一起使用。使用 vue inspect
命令查看生成的 Webpack 配置。
我在 vue.config.js
中有 chainWebpack
部分。我
chainWebpack: config => {
// Add "node_modules" alias
config.resolve.alias
.set('node_modules', path.join(__dirname, './node_modules'));
config.devtool('source-map');
// Do not remove whitespaces
config.module.rule('vue')
.use('vue-loader')
.loader('vue-loader')
.tap(options => {
options.compilerOptions.preserveWhitespace = true
return options
})
}
我想包括 infrastructureLogging
部分以将日志记录重定向到 stdout
而不是 stderr
:
module.exports = {
//...
infrastructureLogging: {
stream: process.stdout,
},
};
如何在使用 chainWebpack
部分时做到这一点?
webpack-chain
(由 chainWebpack
使用)似乎不支持 infrastructureLogging
.
但是,您可以使用 configureWebpack
将该选项传递给 Webpack:
module.exports = {
configureWebpack: {
infrastructureLogging: {
stream: process.stdout,
},
}
}
注意chainWebpack
和configureWebpack
可以一起使用。使用 vue inspect
命令查看生成的 Webpack 配置。