-
Notifications
You must be signed in to change notification settings - Fork 1
/
.rescriptsrc.js
37 lines (35 loc) · 1.38 KB
/
.rescriptsrc.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
const jestConfig = require("./jest.config");
const webpackConfig = require("./webpack.config");
module.exports = [
["use-babel-config", ".babelrc"],
{
jest: (config) => {
let result = Object.assign({}, config, jestConfig);
result.transform["^.+\\.(js|jsx|ts|tsx)$"] = "babel-jest";
result.moduleDirectories = webpackConfig.resolve.modules;
return result;
},
webpack: (webpack) => {
webpack.plugins = webpack.plugins.filter((plugin) => plugin.key !== "ESLintWebpackPlugin")
webpack.resolve.modules = webpackConfig.resolve.modules;
webpack.resolve.extensions = webpackConfig.resolve.extensions;
webpack.optimization.splitChunks = webpackConfig.optimization.splitChunks;
webpack.optimization.runtimeChunk = webpackConfig.optimization.runtimeChunk;
webpack.output.filename = webpackConfig.output.filename;
webpack.resolve.alias = Object.assign({}, webpack.resolve.alias, webpackConfig.resolve.alias);
// webpack.optimization.minimize = false; // uncomment to debug builds
webpack.module.rules[1].oneOf.forEach((each) => {
if (each.test && each.test.toString().match("png")) {
each.options.limit = true;
}
if (each.test && each.test.toString().match("css")) {
each.use = ["to-string-loader", "css-loader"];
}
if (each.test && each.test.toString().match("scss")) {
each.use.push("sass-loader");
}
});
return webpack;
}
}
];