UNPKG

1.75 kBJavaScriptView Raw
1const base = require("./base");
2const path = require('path');
3const webpack = require("webpack");
4const CleanWebpackPlugin = require('clean-webpack-plugin');
5const merge = require("webpack-merge");
6const es3ifyPlugin = require('es3ify-webpack-plugin');
7const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
8
9const cleanWebpackPlugin = new CleanWebpackPlugin('dist/**');
10// const uglifyJsPlugin = new new webpack.optimize.UglifyJsPlugin({
11// ie8: true,
12// keep_fnames: true,
13// parallel: true,
14// sourceMap: true
15// });
16
17module.exports = merge(base, {
18 mode: 'production',
19
20 devtool: 'source-map',
21
22 // entry: {
23 // production: path.resolve(__dirname, './views/production/app.jsx'),
24 // },
25
26 entry: './src/index.js',
27
28 // output: {
29 // path: path.resolve(__dirname, 'dist'),
30 // filename: 'js/[name].js',
31 // publicPath: '/',
32 // chunkFilename: 'js/[name].js',
33 // },
34
35 output: {
36 path: path.resolve(__dirname, '../dist'),
37 publicPath: '/dist/',
38 filename: 'main.js',
39 // library: 'fb-core',
40 // libraryTarget: 'cmd',
41 // umdNamedDefine: true
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 //'react',
69 'stage-2',
70 ],
71 plugins: ['transform-runtime'],
72 },
73 },
74 //include: [path.resolve(__dirname, 'views')],
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