core
core copied to clipboard
Easy-Webpack example not detecting generateConfig
I am trying to learn easy-webpack
and am following the easy-webpack/core
walk through. In doing so I have attempted to implement the expanded example here. However I get an error
config = generateConfig(common, development, css);
^
TypeError: generateConfig is not a function
when I attempt to run webpack with
NODE_ENV=development node node_modules/webpack/bin/webpack.js
My webpack.js is
var path = require('path');
var DefinePlugin = require('webpack/lib/DefinePlugin');
var common = {
entry: {
'app': ['./ClientApp/boot']
},
output: {
path: path.resolve('./wwwroot/dist'),
}
};
var development = {
devtool: 'cheap-module-inline-source-map',
debug: true,
output: {
filename: '[name].bundle.js',
sourceMapFilename: '[name].bundle.map',
chunkFilename: '[id].chunk.js'
},
plugins: [
new DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('development')
}
})
]
};
var production = {
devtool: 'source-map',
debug: false,
output: {
filename: '[name].[chunkhash].bundle.js',
sourceMapFilename: '[name].[chunkhash].bundle.map',
chunkFilename: '[id].[chunkhash].chunk.js'
},
plugins: [
new DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production')
}
})
]
};
var css = {
module: {
loaders: [{
test: /\.css$/i,
loaders: ['style', 'css']
}]
}
};
var generateConfig = require('@easy-webpack/core').generateConfig;
var config;
switch (process.env.NODE_ENV) {
case 'development':
config = generateConfig(common, development, css);
break;
case 'production':
config = generateConfig(common, production, css);
break;
}
module.exports = config;
Where generateConfig
is documented?