-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathwebpack.config.js
More file actions
40 lines (39 loc) · 1.06 KB
/
webpack.config.js
File metadata and controls
40 lines (39 loc) · 1.06 KB
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
const path = require('path');
const HtmlWebpackPlugin = require("html-webpack-plugin");
const htmlWebpackPlugin = new HtmlWebpackPlugin({
template: path.join(__dirname, "./src/index.html"),
filename: "./index.html",
inject: 'body'
});
const {CleanWebpackPlugin} = require("clean-webpack-plugin");
const webpack = require('webpack');
module.exports = {
mode: 'development',
entry: path.join(__dirname, "./src/index.js"),
output: {
path: path.join(__dirname, "dist/"),
filename: "[name].[hash:6].js"
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
use: "babel-loader",
exclude: /node_modules/
}
]
},
plugins: [
htmlWebpackPlugin,
new CleanWebpackPlugin(),
new webpack.ProvidePlugin({
'console': path.join(__dirname,'/src/console.js') // [before compile] need to use CommonJS Module System
}),
],
resolve: {
extensions: [".js", ".jsx"]
},
devServer: {
port: 8080
}
};