1 | const base = require("./base");
|
2 | const path = require('path');
|
3 | const webpack = require("webpack");
|
4 | const CleanWebpackPlugin = require('clean-webpack-plugin');
|
5 | const merge = require("webpack-merge");
|
6 | const es3ifyPlugin = require('es3ify-webpack-plugin');
|
7 | const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
|
8 |
|
9 | const cleanWebpackPlugin = new CleanWebpackPlugin('dist/**');
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | module.exports = merge(base, {
|
18 | mode: 'production',
|
19 |
|
20 | devtool: 'source-map',
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 | entry: './src/index.js',
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 | output: {
|
36 | path: path.resolve(__dirname, '../dist'),
|
37 | publicPath: '/dist/',
|
38 | filename: 'main.js',
|
39 |
|
40 |
|
41 |
|
42 | },
|
43 |
|
44 |
|
45 | plugins: [
|
46 | cleanWebpackPlugin
|
47 | ],
|
48 |
|
49 | module: {
|
50 | rules: [
|
51 | {
|
52 | test: /\.jsx?$/,
|
53 | use: {
|
54 | loader: 'babel-loader',
|
55 | options: {
|
56 | presets: [
|
57 | [
|
58 | 'env',
|
59 | {
|
60 | targets: {
|
61 | browsers: ['last 2 versions', 'ie >= 7'],
|
62 | },
|
63 | modules: 'commonjs',
|
64 | useBuiltIns: true,
|
65 | debug: false,
|
66 | },
|
67 | ],
|
68 |
|
69 | 'stage-2',
|
70 | ],
|
71 | plugins: ['transform-runtime'],
|
72 | },
|
73 | },
|
74 |
|
75 | },
|
76 | ]
|
77 | },
|
78 |
|
79 | optimization: {
|
80 | minimizer: [
|
81 | new UglifyJsPlugin({
|
82 | uglifyOptions: {
|
83 | ie8: true,
|
84 | },
|
85 | sourceMap: true,
|
86 | }),
|
87 | ],
|
88 | }
|
89 | }); |
\ | No newline at end of file |