-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathdev.config.js
98 lines (87 loc) · 2.42 KB
/
dev.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const WebpackConfig = {
// Source map type
// @see https://webpack.js.org/configuration/devtool/
devtool: 'eval-source-map',
entry: {
// Webpack dev server
'devServer': `webpack-dev-server/client?http://0.0.0.0:8080`,
// Plugin entry points
'widget/widget': path.join(__dirname, '../src/widget/widget.js')
},
output: {
path: path.join(__dirname, '../'),
filename: '[name].js',
publicPath: 'http://0.0.0.0:8080/'
},
externals: {
buildfire: 'buildfire'
},
module: {
rules: [
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
}
]
},
plugins: [
new HtmlWebpackPlugin({
filename: 'widget/index.html',
inject: true,
minify: { removeComments: true, collapseWhitespace: true },
template: path.join(__dirname, '../src/widget/index.html'),
chunks: ['devServer', 'widget/widget']
}),
new CopyWebpackPlugin([{
from: path.join(__dirname, '../src/widget'),
to: path.join(__dirname, '../widget'),
}, {
from: path.join(__dirname, '../src/resources'),
to: path.join(__dirname, '../resources'),
}], {
ignore: ['*.js', '*.html', '*.md']
}),
new CopyWebpackPlugin([{
from: path.join(__dirname, '../src/widget'),
to: path.join(__dirname, '../dist/widget'),
}]),
new CopyWebpackPlugin([{
from: path.join(__dirname, '../src/control'),
to: path.join(__dirname, '../control'),
}]),
new CopyWebpackPlugin([{
from: path.join(__dirname, '../../../styles'),
to: path.join(__dirname, '../styles'),
}, {
from: path.join(__dirname, '../../../scripts'),
to: path.join(__dirname, '../scripts'),
}, {
from: path.join(__dirname, '../../../fonticons'),
to: path.join(__dirname, '../fonticons'),
}])
],
devServer: {
port: 8080,
host: '0.0.0.0',
inline: true,
contentBase: path.join(__dirname, '../dist'),
publicPath: '/',
quiet: false,
noInfo: false,
disableHostCheck: true,
}
};
module.exports = WebpackConfig;