-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
43 lines (41 loc) · 1.07 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
// PACKAGE
require("@babel/polyfill")
const webpack = require('webpack')
const envConfig = require('./config/env')
const miniCSS = require('mini-css-extract-plugin')
const optimizeCSS = require('optimize-css-assets-webpack-plugin')
const optimizeJS = require('terser-webpack-plugin')
module.exports = {
mode: process.env.NODE_ENV || 'development',
entry: ['@babel/polyfill', './src/index.js'],
output: {
filename: 'bundle.js',
path: __dirname + '/public',
publicPath: '/'
},
resolve: {
extensions: ['.js', '.json', '.jsx']
},
devServer: {
historyApiFallback: true,
contentBase: "./public",
port: 8080
},
optimization: {
minimizer: [
new optimizeCSS({}),
new optimizeJS({})
]
},
plugins: [
new miniCSS({ filename: 'style.css' }),
new webpack.DefinePlugin(envConfig.keys)
],
module: {
rules: [
{ test: /.js[x]?$/, use: ['babel-loader'] },
{ test: /\.s?[ac]ss$/, use: [miniCSS.loader, 'css-loader', 'sass-loader'] },
{ test: /\.(woff|woff2|eot|ttf|svg)$/, use: ['file-loader'] }
]
}
}