-
Notifications
You must be signed in to change notification settings - Fork 23
/
webpack.config.js
54 lines (48 loc) · 1 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
46
47
48
49
50
51
52
53
54
'use strict'
const path = require('path')
const base = {
entry: {
'flipbook-viewer': {
import: './src/index.js',
library: {
name: 'flipbook',
type: 'umd',
umdNamedDefine: true,
},
},
'pdf.worker': 'pdfjs-dist/build/pdf.worker.entry',
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist'),
clean: true,
},
module: {
rules: [
{
test: /\.svg$/,
loader: 'svg-inline-loader'
}
]
}
}
const dev = Object.assign({}, base, {
mode: 'development',
devtool: 'inline-source-map',
devServer: {
static: './test',
allowedHosts: 'testing-page-flip.com',
},
entry: Object.assign({
'test-imgs': './test/test-imgs.js',
'test-pdf': './test/test-pdf.js',
'test-pdf-sp': './test/test-pdf-sp.js',
}, base.entry),
})
const prod = Object.assign({}, base, {
mode: "production",
})
module.exports = env => {
if(!env.production && env.development) return dev
else return prod
}