-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathwebpack.dev.mjs
73 lines (67 loc) · 2 KB
/
webpack.dev.mjs
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
/* @flow */
import path, { dirname } from 'path';
import { fileURLToPath } from 'url';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import webpackTemplate from 'html-webpack-template';
import webpack from 'webpack';
const __filename = fileURLToPath(import.meta.url)
const __dirname = `${dirname(__filename)}`
const baseHref = '/muse2/';
const babelConfig = {
'presets': [
[
'@babel/env', {
'targets': {
'ie': 11,
'chrome': 27,
'firefox': 30,
'safari': 7,
'opera': 23
},
'loose': true,
'exclude': [
'transform-regenerator'
]
}
],
'@babel/react',
'@babel/flow'
],
'plugins': [
[ 'transform-inline-environment-variables' ],
'@babel/plugin-transform-modules-commonjs',
[ '@babel/plugin-syntax-dynamic-import', { 'loose': true } ],
[ '@babel/plugin-proposal-decorators', { 'loose': true, 'legacy': true } ],
[ '@babel/plugin-proposal-class-properties', { 'loose': true } ],
[ '@babel/plugin-transform-for-of', { 'assumeArray': true } ],
[ '@babel/plugin-transform-runtime', { 'corejs': false, 'helpers': true, 'regenerator': false } ]
]
};
const webpackConfig = {
mode: 'development',
entry: path.resolve(__dirname, 'iframes/identity/identity.js'),
devtool: 'source-map',
output: {
path: path.resolve(__dirname, 'dist/identity'),
filename: 'identity.js',
publicPath: '/muse2/'
},
plugins: [ new HtmlWebpackPlugin({
inject: false,
template: webpackTemplate,
title: 'Identity',
showErrors: false,
baseHref
}) ],
module: {
rules: [ {
test: /\.js$/,
loader: 'babel-loader',
options: babelConfig
} ]
},
devServer: {
allowedHosts: ['paypal.com', 'localhost.paypal.com']
}
};
export default webpackConfig;