|
1 | | -const webpack = require('webpack'); |
2 | | -const path = require('path'); |
3 | | -const HtmlWebpackPlugin = require('html-webpack-plugin'); |
4 | | -const MiniCssExtractPlugin = require('mini-css-extract-plugin'); |
5 | | -const TerserPlugin = require('terser-webpack-plugin'); |
6 | | -const nodeExternals = require('webpack-node-externals'); |
| 1 | +// Old config. Keeping just in case something breaks with the new webpack |
7 | 2 |
|
| 3 | +// const webpack = require('webpack'); |
| 4 | +// const path = require('path'); |
| 5 | +// const HtmlWebpackPlugin = require('html-webpack-plugin'); |
| 6 | +// const MiniCssExtractPlugin = require('mini-css-extract-plugin'); |
| 7 | +// const TerserPlugin = require('terser-webpack-plugin'); |
| 8 | +// const nodeExternals = require('webpack-node-externals'); |
8 | 9 |
|
9 | | -// Any directories you will be adding code/files into, |
10 | | -// need to be added to this array so webpack will pick them up |
11 | | -const defaultInclude = path.resolve(__dirname, 'src'); |
| 10 | +// // Any directories you will be adding code/files into, |
| 11 | +// // need to be added to this array so webpack will pick them up |
| 12 | +// const defaultInclude = path.resolve(__dirname, 'src'); |
12 | 13 |
|
13 | | -module.exports = { |
14 | | - module: { |
15 | | - rules: [ |
16 | | - { |
17 | | - test: /\.css$/, |
18 | | - use: [ |
19 | | - MiniCssExtractPlugin.loader, |
20 | | - 'css-loader', |
21 | | - ], |
22 | | - include: defaultInclude, |
23 | | - }, |
24 | | - { |
25 | | - test: /\.scss$/, |
26 | | - use: [ |
27 | | - 'style-loader', |
28 | | - 'css-loader', |
29 | | - 'sass-loader', |
30 | | - ], |
31 | | - include: defaultInclude, |
32 | | - }, |
33 | | - { |
34 | | - test: /\.jsx?$/, |
35 | | - use: [{ loader: 'babel-loader' }], |
36 | | - include: defaultInclude, |
37 | | - }, |
38 | | - { |
39 | | - test: /\.(jpe?g|png|gif)$/, |
40 | | - use: [{ loader: 'file-loader?name=img/[name]__[hash:base64:5].[ext]' }], |
41 | | - include: defaultInclude, |
42 | | - }, |
43 | | - { |
44 | | - test: /\.(eot|svg|ttf|woff|woff2|mp3)$/, |
45 | | - use: [{ loader: 'file-loader?name=font/[name]__[hash:base64:5].[ext]' }], |
46 | | - include: defaultInclude, |
47 | | - }, |
48 | | - ], |
49 | | - }, |
50 | | - target: 'electron-renderer', |
51 | | - optimization: { |
52 | | - minimize: true, |
53 | | - minimizer: [new TerserPlugin({ |
54 | | - terserOptions: { |
55 | | - compress: { |
56 | | - |
57 | | - }, |
58 | | - }, |
59 | | - })], |
60 | | - }, |
61 | | - externals: [nodeExternals()], |
62 | | - plugins: [ |
63 | | - new HtmlWebpackPlugin(), |
64 | | - new MiniCssExtractPlugin({ |
65 | | - // Options similar to the same options in webpackOptions.output |
66 | | - // both options are optional |
67 | | - filename: 'bundle.css', |
68 | | - chunkFilename: '[id].css', |
69 | | - }), |
70 | | - new webpack.DefinePlugin({ |
71 | | - 'process.env.NODE_ENV': JSON.stringify('production'), |
72 | | - }), |
73 | | - ], |
74 | | - stats: { |
75 | | - colors: true, |
76 | | - children: false, |
77 | | - chunks: false, |
78 | | - modules: false, |
79 | | - }, |
80 | | -}; |
| 14 | +// module.exports = { |
| 15 | +// module: { |
| 16 | +// rules: [ |
| 17 | +// { |
| 18 | +// test: /\.css$/, |
| 19 | +// use: [ |
| 20 | +// MiniCssExtractPlugin.loader, |
| 21 | +// 'css-loader', |
| 22 | +// ], |
| 23 | +// include: defaultInclude, |
| 24 | +// }, |
| 25 | +// { |
| 26 | +// test: /\.scss$/, |
| 27 | +// use: [ |
| 28 | +// 'style-loader', |
| 29 | +// 'css-loader', |
| 30 | +// 'sass-loader', |
| 31 | +// ], |
| 32 | +// include: defaultInclude, |
| 33 | +// }, |
| 34 | +// { |
| 35 | +// test: /\.jsx?$/, |
| 36 | +// use: [{ loader: 'babel-loader' }], |
| 37 | +// include: defaultInclude, |
| 38 | +// }, |
| 39 | +// { |
| 40 | +// test: /\.(jpe?g|png|gif)$/, |
| 41 | +// use: [{ loader: 'file-loader?name=img/[name]__[hash:base64:5].[ext]' }], |
| 42 | +// include: defaultInclude, |
| 43 | +// }, |
| 44 | +// { |
| 45 | +// test: /\.(eot|svg|ttf|woff|woff2|mp3)$/, |
| 46 | +// use: [{ loader: 'file-loader?name=font/[name]__[hash:base64:5].[ext]' }], |
| 47 | +// include: defaultInclude, |
| 48 | +// }, |
| 49 | +// ], |
| 50 | +// }, |
| 51 | +// target: 'electron-renderer', |
| 52 | +// optimization: { |
| 53 | +// minimize: true, |
| 54 | +// minimizer: [new TerserPlugin({ |
| 55 | +// terserOptions: { |
| 56 | +// compress: { |
| 57 | + |
| 58 | +// }, |
| 59 | +// }, |
| 60 | +// })], |
| 61 | +// }, |
| 62 | +// externals: [nodeExternals()], |
| 63 | +// plugins: [ |
| 64 | +// new HtmlWebpackPlugin(), |
| 65 | +// new MiniCssExtractPlugin({ |
| 66 | +// // Options similar to the same options in webpackOptions.output |
| 67 | +// // both options are optional |
| 68 | +// filename: 'bundle.css', |
| 69 | +// chunkFilename: '[id].css', |
| 70 | +// }), |
| 71 | +// new webpack.DefinePlugin({ |
| 72 | +// 'process.env.NODE_ENV': JSON.stringify('production'), |
| 73 | +// }), |
| 74 | +// ], |
| 75 | +// stats: { |
| 76 | +// colors: true, |
| 77 | +// children: false, |
| 78 | +// chunks: false, |
| 79 | +// modules: false, |
| 80 | +// }, |
| 81 | +// }; |
0 commit comments