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
46 lines (45 loc) · 1.29 KB
/
Copy pathbabel.config.js
File metadata and controls
46 lines (45 loc) · 1.29 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
const path = require('path');
module.exports = function (api) {
api.cache(false);
const slash = `\\${path.sep}`;
return {
parserOpts: {
strictMode: true,
},
targets: {
browsers: ['chrome >= 89', 'firefox >= 89'],
},
overrides: [
{
test: new RegExp(
`^${path.join(__dirname, 'ui')}${slash}(?:components|contexts|hooks|layouts|pages)${slash}(?:.(?!\\.(?:test|stories|container)))+\\.(?: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). This plugin lets us target es2020-level
// browsers (except we do still end up with transpiled logical assignment
// operators 😭)
'@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/',
},
],
],
presets: [
'@babel/preset-typescript',
'@babel/preset-env',
'@babel/preset-react',
],
};
};