-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathwebpack.config.babel.js
More file actions
89 lines (80 loc) · 1.89 KB
/
Copy pathwebpack.config.babel.js
File metadata and controls
89 lines (80 loc) · 1.89 KB
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
import webpack from 'webpack'
import path from 'path'
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'
import TerserPlugin from 'terser-webpack-plugin'
const ENV = process.env.NODE_ENV || 'development'
module.exports = {
context: path.resolve(__dirname, 'src'),
optimization: {
minimize: ENV === 'production',
minimizer: [new TerserPlugin({
parallel: true,
terserOptions: {
compress: {
negate_iife: false,
properties: false,
ie8: true
},
mangle: {
ie8: true
},
output: {
comments: false,
ie8: true
}
}
})],
emitOnErrors: false
},
entry: './index.js',
output: {
path: path.resolve(__dirname, 'dist'),
publicPath: '/',
filename: 'location-autocomplete.min.js',
library: 'openregisterLocationPicker',
libraryExport: 'default',
libraryTarget: 'umd'
},
module: {
rules: [
{
test: /\.js$/,
exclude: path.resolve(__dirname, 'src'),
enforce: 'pre',
loader: 'source-map-loader'
},
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader'
}
]
},
plugins: ([
new BundleAnalyzerPlugin({
analyzerMode: 'static',
openAnalyzer: false
})
]),
node: {
global: true,
__filename: false,
__dirname: false
},
mode: ENV === 'production' ? 'production' : 'development',
devtool: ENV === 'production' ? 'source-map' : 'eval-cheap-module-source-map',
devServer: {
port: process.env.PORT || 8080,
host: '0.0.0.0',
devMiddleware: {
publicPath: '/dist/'
},
static: [
'./examples',
'./' // So that ../dist/location-autocomplete-graph.json maps to the same file both with dev server and without.
],
historyApiFallback: true,
open: true,
allowedHosts: 'all'
}
}