-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
47 lines (46 loc) · 1.09 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
const webpack = require('webpack');
const path = require('path');
const commitHash = require('child_process')
.execSync('git rev-parse --short HEAD')
.toString()
.trim();
module.exports = (env, argv) => ({
entry: './src/index.js',
output: {
filename: argv.mode === 'development' ? 'ada-charts.js' : `ada-charts-${commitHash}.min.js`,
path: path.resolve(__dirname, 'lib'),
library: 'AdaCharts',
libraryExport: 'default',
libraryTarget: 'var',
hotUpdateChunkFilename: 'hot/hot-update.js',
hotUpdateMainFilename: 'hot/hot-update.json',
},
module: {
rules: [
{
test: /\.css$/,
exclude: /node_modules/,
use: [
{ loader: 'style-loader' },
{ loader: 'css-loader' },
],
},
{
test: /\.(png|woff|woff2|eot|ttf|svg)$/,
loader: 'url-loader',
},
],
},
devtool: '#inline-source-map',
context: __dirname,
target: 'web',
devServer: {
host: '0.0.0.0',
port: '8080',
hot: true,
inline: true,
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
],
});