mirror of
https://github.com/WhitestormJS/whs.js.git
synced 2026-02-01 16:57:32 +00:00
45 lines
882 B
JavaScript
45 lines
882 B
JavaScript
import {join} from 'path';
|
|
import webpack from 'webpack';
|
|
|
|
process.env.BABEL_ENV = 'browser';
|
|
|
|
function config({production}) {
|
|
return {
|
|
devtool: production ? 'hidden-source-map' : 'eval-source-map',
|
|
entry: './src/index.js',
|
|
output: {
|
|
path: join(__dirname, 'build'),
|
|
filename: 'whitestorm.js',
|
|
library: 'WHS',
|
|
libraryTarget: 'var'
|
|
},
|
|
module: {
|
|
loaders: [
|
|
{
|
|
test: /\.js$/,
|
|
exclude: /node_modules/,
|
|
loader: 'babel'
|
|
}
|
|
]
|
|
},
|
|
plugins: production
|
|
? [
|
|
new webpack.optimize.DedupePlugin(),
|
|
new webpack.optimize.UglifyJsPlugin({
|
|
mangle: false,
|
|
compress: {
|
|
warnings: false
|
|
}
|
|
}),
|
|
new webpack.ProvidePlugin({
|
|
THREE: 'three'
|
|
})
|
|
]
|
|
: []
|
|
};
|
|
}
|
|
|
|
export {
|
|
config as default
|
|
};
|