-
Notifications
You must be signed in to change notification settings - Fork 4
/
webpack.config.js
38 lines (36 loc) · 975 Bytes
/
webpack.config.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
const path = require("path");
const glob = require("glob");
const defaultConfig = require("./node_modules/@wordpress/scripts/config/webpack.config");
// Remove defaultConfig sass loader config so we can add ours below
let moduleRules = defaultConfig.module.rules.filter(rule => {
return !rule.test.toString().includes('(sc|sa)ss')
});
module.exports = {
...defaultConfig,
entry: glob("./js/blocks/**/index.js", { sync: true }),
output: {
filename: "blocks.js",
path: path.resolve(__dirname, "js/build")
},
module: {
...defaultConfig.module,
rules: [
...moduleRules,
{
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",
],
},
{
test: /\.svg$/,
use: ["@svgr/webpack", "url-loader"]
},
]
}
};