-
Notifications
You must be signed in to change notification settings - Fork 333
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apply Babel transforms (without polyfills) on Rollup builds
Transforms will be applied based on `.browserslistrc` supported browsers, with helper functions bundled if needed
- Loading branch information
1 parent
35f6f6a
commit d2c4e2e
Showing
6 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* Babel config | ||
* | ||
* @type {import('@babel/core').ConfigFunction} | ||
*/ | ||
module.exports = function (api) { | ||
const browserslistEnv = !api.env('test') | ||
? 'javascripts' | ||
: 'node' | ||
|
||
return { | ||
presets: [ | ||
['@babel/preset-env', { | ||
browserslistEnv, | ||
loose: browserslistEnv === 'javascripts', | ||
|
||
// Transform ES modules for Node.js | ||
modules: browserslistEnv === 'node' ? 'auto' : false | ||
}] | ||
] | ||
} | ||
} |
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
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
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
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