-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.prod.js
54 lines (51 loc) · 1.33 KB
/
webpack.config.prod.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
const path = require('path');
const HtmlWebPackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
mode: 'production',
entry: ['@babel/polyfill', './src/index.js'],
output: {
filename: '[name].[contenthash].js',
path: path.resolve(__dirname, 'public')
},
resolve: {
extensions: ['.js', '.jsx']
},
module: {
rules: [{
test: /\.jsx?$/,
loader: 'babel-loader'
},
{
test: /\.(sa|sc|c)ss$/,
use: ['style-loader', 'css-loader', 'sass-loader']
},
{
include: /node_modules/,
test: /\.(eot|gif|otf|png|svg|ttf|woff)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
use: ['file-loader'],
}
]
},
plugins: [
new HtmlWebPackPlugin({
title: 'Caching',
template: './src/index.html',
favicon: './src/favicon.ico',
inject: true
}),
new CopyWebpackPlugin([
{
context: './src/images',
from: '**/*',
to: './images'
}
])
],
externals: {
// global app config object
config: JSON.stringify({
apiUrl: 'https://localhost:44320/api'
})
}
}