forked from survivejs-demos/webpack-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.lib.js
49 lines (43 loc) · 842 Bytes
/
webpack.lib.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
const path = require('path');
const merge = require('webpack-merge');
const parts = require('./webpack.parts');
const PATHS = {
lib: path.join(__dirname, 'lib'),
build: path.join(__dirname, 'dist'),
};
const commonConfig = merge([
{
entry: {
lib: PATHS.lib,
},
output: {
path: PATHS.build,
library: 'Demo',
libraryTarget: 'var', // Default
},
},
parts.attachRevision(),
parts.generateSourceMaps({ type: 'source-map' }),
parts.loadJavaScript({ include: PATHS.lib }),
]);
const libraryConfig = merge([
commonConfig,
{
output: {
filename: '[name].js',
},
},
]);
const libraryMinConfig = merge([
commonConfig,
{
output: {
filename: '[name].min.js',
},
},
parts.minifyJavaScript(),
]);
module.exports = [
libraryConfig,
libraryMinConfig,
];