-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathwebpack.js
41 lines (38 loc) · 1004 Bytes
/
webpack.js
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
41
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
const webpack = require('webpack');
module.exports = {
entry: './index.js',
output: {
filename: "[name].bundle.js",
path: path.resolve(__dirname, 'dist'),
},
resolve: {
extensions: [".js", ".ts"]
},
module: {
rules: [
{
test: /\.css$/,
use:['style-loader','css-loader']
}
]
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new HtmlWebpackPlugin({
hash: true,
template: './index.html',
path: path.resolve(__dirname, 'dist'),
// inject : 'head',
filename: 'index.html' //relative to root of the application
})
],
mode: 'development',
devtool: 'cheap-module-source-map',
devServer: {
contentBase: path.join(__dirname, "dist"),
port: 8080,
hot: true
}
}