0
我相信[email protected]支持從webpack.config.js返回一個函數。當我嘗試它,我試圖通過--env.foo=1
我繼續得到 Config did not export an object
。Webpack 3.5.5 module.exports = function:配置沒有導出對象
這是我的整個webpack.config.js,但我想這只是最後一行的重要。這有什麼不對?
var webpack = require('webpack');
var path = require('path');
var BUILD_DIR = path.resolve(__dirname, 'static/public');
var APP_DIR = path.resolve(__dirname, 'static/js');
PROD = 1
var config = {
entry: APP_DIR + '/index.js',
output: {
path: BUILD_DIR,
filename: 'bundle.min.js'
},
module: {
loaders: [{
test: /\.jsx?/,
include: APP_DIR,
loader: 'babel',
query: {
presets: ['es2015', 'react', 'stage-2'] //, 'react-hmre']
}
}]
}
};
module.exports = function (env){return config};
我已經配置對象的工作(截斷它的問題的目的),但現在想在CLI ARGS我要導出函數,而不是通過。