/
webpack.prod.config.js
48 lines (41 loc) · 1.12 KB
/
webpack.prod.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
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { resolve } = require('path');
module.exports = {
entry: ['babel-polyfill', './src/index.js'],
mode: 'production',
output: {
filename: 'afor-v0.6.5-[hash].js',
path: resolve(__dirname, 'build'),
publicPath: '/',
},
module: {
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
options: {
presets: ["@babel/preset-env", "@babel/preset-react"],
plugins: ["@babel/plugin-proposal-export-default-from"]
},
exclude: ['/node_modules']
},
{
test: /\.scss$/,
loaders: ['style-loader', 'css-loader', 'sass-loader'],
exclude: ['/node_modules']
},
{ test: /\.(png|jpg|gif)$/, use: 'url-loader' },
{ test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, use: 'url-loader' }
]
},
plugins: [
new webpack.optimize.ModuleConcatenationPlugin(),
new HtmlWebpackPlugin({
template: './src/index.html',
filename: 'index.html',
inject: 'body',
}),
new webpack.HotModuleReplacementPlugin()
]
}