-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.babel.js
70 lines (58 loc) · 1.44 KB
/
webpack.config.babel.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
import HtmlWebpackPlugin from 'html-webpack-plugin';
import merge from 'webpack-merge';
import path from 'path';
import CopyWebpackPlugin from 'copy-webpack-plugin';
const isProdBuild = process.env.NODE_ENV == 'production';
const webpackCommon = {
entry: {
app: './tests/integration/index.jsx'
},
output: {
path: path.resolve(__dirname, 'build/js-integration'),
filename: '[name].js'
},
module: {
loaders: [
{
test: /\.jsx?$/,
loaders: ['babel-loader']
}
]
},
plugins: [
new HtmlWebpackPlugin({
template: './tests/integration/index.html',
filename: './index.html',
})
],
resolve: {
extensions: ['.tsx', '.ts', '.jsx', '.js', '.css']
},
};
const webpackDev = {
devServer: {
historyApiFallback: true,
stats: 'minimal',
inline: true,
port: 8899,
},
resolve: {
alias: {
api: path.resolve(__dirname, './src')
}
}
};
const webpackProd = {
plugins: [
new CopyWebpackPlugin([{
from: path.resolve(__dirname, 'build/lib/index.min.js'),
to: '.'
}])
],
resolve: {
alias: {
api: path.resolve(__dirname, 'build/lib/index.min.js')
}
}
};
module.exports = isProdBuild ? merge(webpackCommon, webpackProd) : merge(webpackCommon, webpackDev);