-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
28 lines (21 loc) · 905 Bytes
/
index.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
const path = require("path");
module.exports = (API, projectOptions) => {
API.chainWebpack((config) => {
config.resolveLoader.modules.prepend(path.join(__dirname, "node_modules"));
config.resolve.extensions.prepend(".coffee");
const coffeeRule = config.module.rule("coffee").test(/\.coffee$/);
coffeeRule.use("cache-loader").loader(require.resolve("cache-loader"));
if (process.env.NODE_ENV === "production" && !!projectOptions.parallel) {
coffeeRule
.use("thread-loader")
.loader(require.resolve("thread-loader"))
.options(
typeof projectOptions.parallel === "number" ? { workers: projectOptions.parallel } : {},
);
}
if (API.hasPlugin("babel")) {
coffeeRule.use("babel-loader").loader(require.resolve("babel-loader"));
}
coffeeRule.use("coffee-loader").loader(require.resolve("coffee-loader"));
});
};