-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
82 lines (68 loc) · 1.45 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
var path = require('path')
var webpack = require('webpack')
var options = {
entry: {},
output: {
path: './dist',
publicPath: '/dist/',
filename: "[name].js",
libraryTarget: 'umd',
library: 'MarkdownX[name]',
},
resolve: {
root: path.join(__dirname, 'node_modules'),
alias: {
},
extensions: ['', '.js'],
},
module: {
loaders: [
{
test: /\.js$/,
loader: 'babel',
exclude: /node_modules/
},
]
},
babel: {
presets: ['es2015', 'stage-0'],
plugins: ['transform-runtime'],
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(process.env.NODE_ENV)
},
'NODE_ENV': JSON.stringify(process.env.NODE_ENV),
'__ENV__': JSON.stringify(process.env.NODE_ENV),
}),
],
devServer: {
historyApiFallback: true,
noInfo: true
},
devtool: '#eval-source-map'
}
if (process.env.NODE_ENV === 'production') {
options.devtool = '#source-map'
}
var tokenOption = Object.assign({}, options)
tokenOption.entry = {
token:'./src/token',
}
tokenOption.output.library = 'MarkdownX'
var nodeOption = Object.assign({}, options)
nodeOption.entry = {
node:'./src/node'
}
nodeOption.output.library = 'MarkdownXNode'
var testOption = Object.assign({}, options)
testOption.entry = {
test:'./src/test'
}
testOption.output.library = 'MarkdownXTest'
module.exports = [
tokenOption,
nodeOption,
testOption,
]