-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathwebpack.config.js
115 lines (114 loc) · 3.63 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
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
module.exports = {
devServer: {
port: '8080',
hot: true,
compress: true,
contentBase: path.resolve(__dirname, './src'),
watchContentBase: true,
historyApiFallback: true,
proxy: {
'/login': {
target: 'http://localhost:5000/'
},
'/signup': {
target: 'http://localhost:5000/'
},
'/listings': {
target: 'http://localhost:5000/'
},
}
},
entry: {
popup: path.resolve(__dirname, "./src/index-popup.js"),
options: path.resolve(__dirname, "./src/index-options.js"),
foreground: path.resolve(__dirname, "./src/index-foreground.js"),
login: path.resolve(__dirname, "./src/index-login.js"),
signup: path.resolve(__dirname, "./src/index-signup.js"),
dashboard: path.resolve(__dirname, "./src/index-dashboard.js")
},
output: {
filename: '[name].bundle.js',
path: path.resolve(__dirname, 'dist'),
// publicPath: '/dist'
},
module: {
rules: [
{
test: /\.jsx?/,
exclude: /(node_modules|bower_components)/,
use: [
{
loader: 'babel-loader',
options: {
presets: [
'@babel/preset-env',
'@babel/preset-react',
{
'plugins': ['@babel/plugin-proposal-class-properties']
}
]
}
}
]
},
{
test: /\.html$/,
use: ['html-loader']
},
{
test: /\.css$/,
// react-step-progress requires in the css styling in the node_modules folder
// exclude: /node_modules/,
use: ['style-loader', 'css-loader'],
},
]
},
plugins: [
new HtmlWebpackPlugin({
filename: 'popup.html',
template: 'src/popup.html',
chunks: ['popup']
}),
new HtmlWebpackPlugin({
filename: 'options.html',
template: 'src/options.html',
chunks: ['options']
}),
new HtmlWebpackPlugin({
filename: 'foreground.html',
template: 'src/foreground.html',
chunks: ['foreground']
}),
new HtmlWebpackPlugin({
filename: 'login.html',
template: 'src/login.html',
chunks: ['login']
}),
new HtmlWebpackPlugin({
filename: 'signup.html',
template: 'src/signup.html',
chunks: ['signup']
}),
new HtmlWebpackPlugin({
filename: 'dashboard.html',
template: 'src/dashboard.html',
chunks: ['dashboard']
}),
new CopyWebpackPlugin({
patterns: [
{ from: 'src/manifest.json', to: '[name].[ext]' },
{ from: 'src/background.js', to: '[name].[ext]' },
{ from: 'src/inject_script.js', to: '[name].[ext]' },
{ from: 'src/assets/*.png', to: '[name].[ext]' }
]
}),
new CleanWebpackPlugin()
],
resolve: {
extensions: ['.js', '.jsx'],
}
}