forked from TwoAbove/noita-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config-overrides.js
executable file
·66 lines (62 loc) · 2.31 KB
/
config-overrides.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
62
63
64
65
66
// const path = require('path');
// const util = require('util');
// const fs = require('fs');
// const getCacheIdentifier = require('react-dev-utils/getCacheIdentifier');
// const appDirectory = fs.realpathSync(process.cwd());
// module.exports = (config) => {
// // return config;
// const isEnvProduction = config.mode === 'production';
// const isEnvDevelopment = !isEnvProduction;
// // get something that has setted appSrc and fill here
// const appSrc = config.module.rules[1].include;
// // https://github.com/webpack/webpack/issues/6642#issuecomment-371087342
// config.output.globalObject = 'this';
// // find the rule with 'oneOf'
// const loaderListRule = config.module.rules.find(ruleObj =>
// Array.isArray(ruleObj.oneOf)
// );
// if (!loaderListRule) {
// throw new Error('No found loader config list');
// }
// loaderListRule.oneOf.unshift({
// test: /\.worker\.(js|mjs|ts)$/,
// include: appSrc,
// use: [
// require.resolve('worker-loader'),
// {
// loader: require.resolve('babel-loader'),
// options: {
// customize: require.resolve(
// 'babel-preset-react-app/webpack-overrides'
// ),
// babelrc: false,
// configFile: false,
// // get preset setting from loader that matches normal js file and fill here
// presets: [require.resolve('babel-preset-react-app')],
// // Make sure we have a unique cache identifier, erring on the
// // side of caution.
// // We remove this when the user ejects because the default
// // is sane and uses Babel options. Instead of options, we use
// // the react-scripts and babel-preset-react-app versions.
// cacheIdentifier: getCacheIdentifier(
// isEnvProduction ? 'production' : isEnvDevelopment && 'development',
// [
// 'babel-plugin-named-asset-import',
// 'babel-preset-react-app',
// 'react-dev-utils',
// 'react-scripts'
// ]
// ),
// plugins: [...loaderListRule.oneOf[2].options.plugins],
// // This is a feature of `babel-loader` for webpack (not Babel itself).
// // It enables caching results in ./node_modules/.cache/babel-loader/
// // directory for faster rebuilds.
// cacheDirectory: true,
// cacheCompression: false,
// compact: isEnvProduction
// }
// }
// ]
// });
// return config;
// };