-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.dev.js
61 lines (60 loc) · 1.57 KB
/
webpack.dev.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
const path = require("path");
const webpack = require("webpack");
const common = require("./webpack.common");
const merge = require("webpack-merge");
const HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = merge(common, {
mode: "development",
devtool: "eval-source-map",
output: {
filename: "[name].bundle.js",
path: path.resolve(__dirname, "build")
},
plugins: [
new HtmlWebpackPlugin({
template: "./public/index.html"
}),
new webpack.DefinePlugin({
BASE_URL: JSON.stringify("http://localhost/builders/"),
BASE_API_URL: JSON.stringify("http://localhost/builders/wp-json/wp/v2/"),
GRAPHQL_URL: JSON.stringify("http://localhost/builders/graphql")
})
],
module: {
rules: [
{
test: /\.s[ac]ss$/i,
use: [
// Creates `style` nodes from JS strings
"style-loader",
// Translates CSS into CommonJS
"css-loader",
// Compiles Sass to CSS
"sass-loader",
{
loader: "sass-resources-loader",
options: {
resources: [
"./src/styles/util/_variables.scss",
"./src/styles/tools/*.scss"
]
}
}
]
},
{
test: /\.css$/i,
use: [
// Creates `style` nodes from JS strings
"style-loader",
// Translates CSS into CommonJS
"css-loader"
]
}
]
},
devServer: {
port: 8082,
historyApiFallback: true //server index.html for any route not found
}
});