-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.dev.config.js
More file actions
47 lines (46 loc) · 1.14 KB
/
webpack.dev.config.js
File metadata and controls
47 lines (46 loc) · 1.14 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
41
42
43
44
45
46
47
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const OpenBrowserPlugin = require('open-browser-webpack-plugin');
module.exports = {
entry: "./src/index.js",
output: {
filename: "bundle.js",
publicPath: '/'
},
devtool: "source-map",
devServer: {
compress: true,
port: 3001,
hot: true,
historyApiFallback: true
// contentBase: path.join(__dirname, "dist")
},
module: {
rules: [
{ test: /\.js$/, exclude: /node_modules/, use: "babel-loader" },
{
test: /\.css$/,
use: ["style-loader","css-loader","postcss-loader"]
},
{ test: /\.(jpe?g|png)$/, use: 'file-loader?name=images/[name].[hash:8].[ext]' }
// {
// test: require.resolve('jquery'),
// use: [{
// loader: 'expose-loader',
// options: '$'
// }]
// }
]
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new HtmlWebpackPlugin({
title: 'hello world',
template: 'templete/index.html'
}),
new OpenBrowserPlugin({
url: 'http://localhost:3000'
})
]
}