forked from MetaMask/metamask-extension
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbabel.config.js
More file actions
62 lines (61 loc) · 1.85 KB
/
Copy pathbabel.config.js
File metadata and controls
62 lines (61 loc) · 1.85 KB
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
const path = require('path');
module.exports = function (api) {
api.cache(false);
const slash = `\\${path.sep}`;
const uiPath = path.join(__dirname, 'ui').replace(/\\/gu, '\\\\');
return {
parserOpts: {
strictMode: true,
},
targets: {
browsers: ['chrome >= 113', 'firefox >= 115'],
},
overrides: [
{
test: new RegExp(
`^${uiPath}${slash}(?:components|contexts|hooks|layouts|pages)${slash}(?!.*(?:\\.(?:test|spec|stories|container)\\.|__mocks__${slash}|\\.d\\.[jt]s$)).*\\.(?:m?[jt]s|[jt]sx)$`,
'u',
),
plugins: [['babel-plugin-react-compiler', { target: '17' }]],
},
],
plugins: [
// `browserify` is old and busted, and doesn't support `??=` (and other
// logical assignment operators) or private class features. Keep these
// syntax transforms enabled even when our browser support floor is high
// enough to run them natively.
'@babel/plugin-transform-class-properties',
'@babel/plugin-transform-private-methods',
'@babel/plugin-transform-private-property-in-object',
'@babel/plugin-transform-logical-assignment-operators',
[
path.resolve(
__dirname,
'development/build/transforms/import-meta-url.js',
),
{
pattern:
/^@metamask\/([^/]+)\/dist\/preinstalled-snap\.json(\.gz)?$/u,
rootPath: '/snaps/',
},
'import-meta-url-snaps',
],
[
path.resolve(
__dirname,
'development/build/transforms/import-meta-url.js',
),
{
pattern: /^@rive-app\/canvas\/(rive)\.wasm$/u,
rootPath: '/images/',
},
'import-meta-url-rive',
],
],
presets: [
'@babel/preset-typescript',
'@babel/preset-env',
'@babel/preset-react',
],
};
};