scratch-vm/webpack.config.js
Ray Schamp e689664733 Build the module to be imported
This puts the details of the loaders needed to build index.js out of the concern of the packages that require it.
2016-09-20 16:35:11 -04:00

45 lines
974 B
JavaScript

var webpack = require('webpack');
var base = {
module: {
loaders: [
{
test: /\.json$/,
loader: 'json-loader'
}, {
test: require.resolve('./src/index.js'),
loader: 'expose?VirtualMachine'
}
]
},
plugins: [
new webpack.optimize.UglifyJsPlugin({
include: /\.min\.js$/,
minimize: true,
compress: {
warnings: false
}
})
]
};
module.exports = [Object.assign({}, base, {
entry: {
'vm': './src/index.js',
'vm.min': './src/index.js'
},
output: {
path: __dirname,
filename: '[name].js'
}
}), Object.assign({}, base, {
entry: {
'dist': './src/index.js'
},
output: {
library: 'VirtualMachine',
libraryTarget: 'commonjs2',
path: __dirname,
filename: '[name].js'
}
})];