forked from transcranial/keras-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
31 lines (28 loc) · 1.07 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const path = require('path')
const webpack = require('webpack')
const config = {
entry: path.resolve(__dirname, 'src/index'),
resolve: { extensions: ['.js'] },
output: { path: path.resolve(__dirname, 'dist'), filename: 'keras.js', library: 'KerasJS', libraryTarget: 'umd' },
module: {
rules: [
{ test: /\.js$/, loader: 'babel-loader', exclude: /node_modules/ },
{ test: /\.(glsl|frag|vert)$/, use: ['raw-loader', 'glslify-loader'], exclude: /node_modules/ }
]
},
node: {
fs: 'empty'
}
}
if (process.env.NODE_ENV === 'production') {
config.devtool = 'cheap-module-source-map'
config.plugins = [
new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify('production') }),
//NOTE: possible bug in uglify-js: unused needs to be set to false or else library will not work properly
new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false, unused: false } })
]
} else {
config.devtool = 'eval'
config.plugins = [new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify('development') })]
}
module.exports = config