|
1 | | -const path = require('path'); |
2 | | -const webpack = require('webpack'); |
3 | | -const HtmlWebpackPlugin = require('html-webpack-plugin'); |
| 1 | +const path = require("path"); |
| 2 | +const webpack = require("webpack"); |
| 3 | +const HtmlWebpackPlugin = require("html-webpack-plugin"); |
4 | 4 |
|
5 | 5 | try { |
6 | | - require('os').networkInterfaces() |
| 6 | + require("os").networkInterfaces(); |
7 | 7 | } catch (e) { |
8 | | - require('os').networkInterfaces = () => ({}) |
| 8 | + require("os").networkInterfaces = () => ({}); |
9 | 9 | } |
10 | 10 |
|
11 | 11 | module.exports = { |
12 | | - entry: [ |
13 | | - './src/app/index.js', |
14 | | - ], |
| 12 | + entry: ["./src/app/index.js"], |
15 | 13 | devServer: { |
16 | 14 | port: 8081, |
17 | | - https: false, |
| 15 | + https: true, |
18 | 16 | disableHostCheck: true, |
19 | | - host: 'localhost', |
| 17 | + host: "0.0.0.0", |
20 | 18 | }, |
21 | 19 | module: { |
22 | | - loaders: [ |
| 20 | + rules: [ |
23 | 21 | { |
24 | 22 | test: /.js?$/, |
25 | | - loaders: ['babel-loader'], |
| 23 | + use: "babel-loader", |
26 | 24 | exclude: /node_modules/, |
27 | 25 | include: path.resolve(__dirname), |
28 | 26 | }, |
29 | 27 | { |
30 | | - test: /\.less$/, |
31 | | - loaders: ["style-loader", "css-loader", "less-loader"] |
32 | | - }, { |
33 | | - test: /\.css$/, |
34 | | - loaders: ["style-loader", "css-loader"] |
| 28 | + test: /\.css/, |
| 29 | + use: ["style-loader", "css-loader"], |
35 | 30 | }, |
36 | 31 | { |
37 | 32 | test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, |
38 | | - loader: "url-loader?limit=10000&mimetype=application/octet-stream" |
39 | | - }, { |
| 33 | + use: "url-loader?limit=10000&mimetype=application/octet-stream", |
| 34 | + }, |
| 35 | + { |
40 | 36 | test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, |
41 | | - loader: "file-loader" |
42 | | - }, { |
| 37 | + use: "file-loader", |
| 38 | + }, |
| 39 | + { |
43 | 40 | test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, |
44 | | - loader: "url-loader?limit=10000&mimetype=image/svg+xml" |
45 | | - }, { |
| 41 | + use: "url-loader?limit=10000&mimetype=image/svg+xml", |
| 42 | + }, |
| 43 | + { |
46 | 44 | test: /\.(jpg|jpeg|gif|png)$/, |
47 | 45 | exclude: /node_modules/, |
48 | | - loader: 'url-loader?limit=65000&name=images/[name].[ext]' |
49 | | - } |
50 | | - ] |
| 46 | + use: "url-loader?limit=65000&name=images/[name].[ext]", |
| 47 | + }, |
| 48 | + ], |
51 | 49 | }, |
52 | 50 | plugins: [ |
53 | | - new webpack.DefinePlugin({ |
54 | | - 'process.env': { |
55 | | - 'NODE_ENV': `""` |
56 | | - } |
57 | | - }), |
58 | 51 | new HtmlWebpackPlugin({ |
59 | 52 | inject: true, |
60 | | - template: './public/index.html' |
| 53 | + template: "./public/index.html", |
61 | 54 | }), |
62 | | - new webpack.NoEmitOnErrorsPlugin() |
63 | | - ] |
| 55 | + new webpack.NoEmitOnErrorsPlugin(), |
| 56 | + ], |
64 | 57 | }; |
0 commit comments