-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
3,386 additions
and
4,870 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,14 @@ | ||
'use strict'; | ||
const PRODUCTION = process.env.NODE_ENV === 'production'; | ||
// https://web.dev/publish-modern-javascript/ | ||
// https://jakearchibald.com/2017/es-modules-in-browsers/ | ||
// const MODERN = process.env.MODERN === 'true'; | ||
const DEV = !PRODUCTION; | ||
const ReactCompilerConfig = { | ||
// compilationMode: 'annotation', | ||
}; | ||
|
||
const config = { | ||
browserslistEnv: PRODUCTION ? 'production' : 'development', | ||
parserOpts: { | ||
strictMode: true, | ||
}, | ||
assumptions: { | ||
// arrayLikeIsIterable: true, | ||
constantReexports: true, | ||
constantSuper: true, | ||
enumerableModuleMeta: true, | ||
ignoreFunctionLength: true, | ||
ignoreToPrimitiveHint: true, | ||
iterableIsArray: true, | ||
mutableTemplateObject: true, | ||
noClassCalls: true, | ||
noDocumentAll: true, | ||
noNewArrows: true, | ||
objectRestNoSymbols: true, | ||
privateFieldsAsProperties: true, | ||
pureGetters: true, | ||
setClassMethods: true, | ||
setComputedProperties: true, | ||
setPublicClassFields: true, | ||
setSpreadProperties: true, | ||
skipForOfIteratorClosing: true, | ||
superIsCallableConstructor: true, | ||
}, | ||
presets: [ | ||
[ | ||
'@babel/preset-typescript', | ||
{ | ||
allowDeclareFields: true, // TODO: Remove in Babel@8+ (it will be the default) | ||
onlyRemoveTypeImports: true, | ||
}, | ||
module.exports = function (api) { | ||
api.cache(true); | ||
return { | ||
plugins: [ | ||
['babel-plugin-react-compiler', ReactCompilerConfig], | ||
'@babel/plugin-syntax-jsx', | ||
['@babel/plugin-syntax-typescript', { isTSX: true }], | ||
], | ||
['@babel/preset-react', { runtime: 'automatic', development: DEV }], | ||
], | ||
plugins: ['babel-plugin-react-compiler'], | ||
}; | ||
}; | ||
|
||
if (DEV) { | ||
config.plugins.unshift('react-refresh/babel'); | ||
} else if (PRODUCTION) { | ||
config.presets.push([ | ||
'@babel/env', | ||
{ | ||
bugfixes: true, // TODO: Remove in Babel@8+ (it will be the default) | ||
}, | ||
]); | ||
|
||
config.plugins.push([ | ||
'polyfill-corejs3', | ||
{ | ||
method: 'usage-global', | ||
version: '3.30.2', | ||
proposals: true, | ||
}, | ||
]); | ||
} | ||
|
||
module.exports = config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.