-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.prod.config.js
45 lines (39 loc) · 1.25 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
const path = require('path');
const webpack = require('webpack');
const config = require('./webpack.base.config.js');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const ChunkManifestPlugin = require('@ussu/chunk-manifest-webpack-plugin');
const AssetsPlugin = require('assets-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
config.bail = true;
config.profile = false;
config.devtool = '#source-map';
config.mode = 'production';
config.output = {
path: path.resolve(__dirname, 'dist'),
publicPath: '/',
filename: 'urf.[name].[hash].js',
chunkFilename: 'urf.[name].[hash].js',
};
config.plugins = config.plugins.concat([
new ChunkManifestPlugin({
filename: 'manifest.json',
manifestVariable: 'webpackManifest',
inlineManifest: false
}),
new AssetsPlugin(),
new CopyWebpackPlugin([
{ from: './src/root', to: './'}
]),
new webpack.DefinePlugin({
URF_API_URL: JSON.stringify("https://api.urfonline.com"),
URF_IMG_ROOT: JSON.stringify("https://urf.imgix.net/"),
}),
]);
config.optimization = {
minimizer: [new TerserPlugin()],
};
config.module.rules = config.module.rules.concat([
{ test: /\.js?$/, loaders: ['babel-loader?envName=bundle'], exclude: /node_modules/ },
]);
module.exports = config;