Skip to content

Commit 0e63b41

Browse files
Create webpack.config.js
1 parent 8bd375b commit 0e63b41

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
const path = require("path");
2+
// import path from 'path';
3+
// import webpack from 'webpack';
4+
const webpack = require("webpack");
5+
// import { WDS_PORT } from './src/shared/config';
6+
// const WDS_PORT = require("./src/shared/config");
7+
// import { isProd } from './src/shared/util';
8+
// const isProd = require(" ./src/shared/util");
9+
10+
module.exports = {
11+
// this is relative path. iw we do not specify default location is:./src/main.js
12+
entry: {
13+
main: [
14+
"@babel/register",
15+
"@babel/polyfill",
16+
"@babel/runtime/regenerator",
17+
18+
"./src/client"
19+
]
20+
},
21+
mode: "development",
22+
output: {
23+
filename: "bundle.js",
24+
path: path.resolve(__dirname, "dist"),
25+
publicPath: "/"
26+
},
27+
devServer: {
28+
contentBase: "dist",
29+
overlay: true,
30+
hot: true,
31+
stats: { colors: true }
32+
},
33+
34+
devtool: "source-map",
35+
module: {
36+
rules: [
37+
{
38+
test: /\.css$/,
39+
use: [
40+
{ loader: "style-loader" },
41+
{ loader: "css-loader", options: { sourceMap: true } }
42+
]
43+
},
44+
{
45+
test: /\.(js|jsx)$/,
46+
use: [{ loader: "babel-loader" }],
47+
include: path.resolve(__dirname, "src"),
48+
exclude: /node_modules/
49+
},
50+
{
51+
test: /\.s?css$/,
52+
use: ["style-loader", "css-loader", "postcss-loader", "sass-loader"]
53+
},
54+
// {
55+
// test: /\.html$/,
56+
// use: [
57+
// {
58+
// loader: 'html-loader',
59+
// options: { attrs: ['img:src', 'link:href'] }
60+
// }
61+
// ]
62+
// },
63+
{
64+
test: /\.(jpg|gif|png)$/,
65+
use: [
66+
{
67+
loader: "file-loader",
68+
options: { name: "images/[name].[ext]" }
69+
}
70+
]
71+
}
72+
]
73+
},
74+
plugins: [
75+
// new webpack.optimize.OccurrenceOrderPlugin(),
76+
// new webpack.HotModuleReplacementPlugin()
77+
// new webpack.NamedModulesPlugin()
78+
// new webpack.NoEmitOnErrorsPlugin()
79+
]
80+
};

0 commit comments

Comments
 (0)