This repository was archived by the owner on Aug 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathwebpack.dev.js
More file actions
56 lines (55 loc) · 1.4 KB
/
webpack.dev.js
File metadata and controls
56 lines (55 loc) · 1.4 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
48
49
50
51
52
53
54
55
56
/* eslint import/no-extraneous-dependencies: 0 */
const merge = require("webpack-merge");
const commonConfig = require("./webpack.common.js");
const path = require("path");
const webpack = require("webpack");
const ExtractTextPlugin = require("extract-text-webpack-plugin");
// eslint-disable-next-line no-undef
module.exports = merge(commonConfig, {
mode: "development",
entry: [
"react-hot-loader/patch",
"webpack-dev-server/client?http://localhost:3032",
"webpack/hot/only-dev-server",
"./demos/index.jsx",
],
devtool: "inline-source-map",
devServer: {
hot: true,
contentBase: path.resolve(__dirname, "./dist/public"), // eslint-disable-line no-undef
port: 3032,
host: "localhost",
publicPath: "/",
historyApiFallback: true,
},
module: {
rules: [
{
test: /\.(jpe?g|png|gif|svg|eot|woff|ttf|svg|woff2)$/,
loader: "file?name=[name].[ext]",
},
{
test: /\.jsx?$/,
use: ["babel-loader"],
exclude: /node_modules/,
},
{
test: /\.css$/,
use: ["style-loader", "css-loader?modules"],
},
{
test: /\.(ttf|eot|woff|woff2)$/,
loader: "file-loader",
options: {
name: "fonts/[name].[ext]",
},
},
],
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new ExtractTextPlugin({
filename: "css/[name].css",
}),
],
});