forked from microbit-foundation/python-editor-v3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
craco.config.js
45 lines (43 loc) · 1.2 KB
/
craco.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
39
40
41
42
43
44
45
/**
* (c) 2021, Micro:bit Educational Foundation and contributors
*
* SPDX-License-Identifier: MIT
*/
const path = require("path");
const fs = require("fs");
// Support optionally pulling in external branding if the module is installed.
const theme = "@microbit-foundation/python-editor-v3-microbit";
const external = `node_modules/${theme}`;
const internal = "src/deployment/default";
module.exports = {
webpack: {
alias: {
"theme-package": fs.existsSync(external)
? theme
: path.resolve(__dirname, internal),
},
configure: {
ignoreWarnings: [
// Temporary version of https://github.com/facebook/create-react-app/pull/11752
function ignoreSourcemapsloaderWarnings(warning) {
return (
warning.module &&
warning.module.resource.includes("node_modules") &&
warning.details &&
warning.details.includes("source-map-loader")
);
},
],
},
},
jest: {
configure: {
moduleNameMapper: {
"^theme-package(.*)$": `<rootDir>/${
fs.existsSync(external) ? external : internal
}$1`,
"\\.worker": "<rootDir>/src/mocks/worker.js",
},
},
},
};