-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.js
45 lines (43 loc) · 1.01 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
const path = require('path')
const webpack = require('webpack')
const package = require('./package.json')
module.exports = (env) => {
const config = {
entry: './src/gpt2.js',
target: 'web',
output: {
filename: env.RUNTIME ? 'bundle.runtime.js' : 'bundle.js',
path: path.resolve(__dirname, '.'),
library: {
type: 'umd',
name: 'gpt2',
export: 'default',
},
},
// Map @tensorflow/tfjs to tf variable
//externals: {
// '@tensorflow/tfjs': 'tf',
//},
plugins: [
new webpack.DefinePlugin({
'VERSION': JSON.stringify(package.version),
'RUNTIME': JSON.stringify(env.RUNTIME),
}),
],
// Update recommended size limit
// performance: {
// hints: false,
// maxEntrypointSize: 512000,
// maxAssetSize: 512000
// },
// Remove comments
optimization: {
minimize: true,
},
// Source map
devtool: env.DEVELOPMENT
? 'eval-source-map'
: false
}
return config
}