Skip to content

Instantly share code, notes, and snippets.

@evasyuk
Created April 5, 2021 08:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evasyuk/7a57cc554c63407d813db17a4d78212a to your computer and use it in GitHub Desktop.
Save evasyuk/7a57cc554c63407d813db17a4d78212a to your computer and use it in GitHub Desktop.
Add babel support to index.js
.babelrc
############################################################
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "current"
}
}
]
],
"plugins": [
"@babel/plugin-syntax-dynamic-import",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-export-default-from"
]
}
############################################################
add closer to the top of index.js
############################################################
process.env.BABEL_DISABLE_CACHE = '1'
require("@babel/register")({
extends: './.babelrc',
ignore: [/node_modules/, /.png/],
extensions: [".js"],
})
require('@babel/polyfill')
############################################################
install dependencies
############################################################
npm i @babel/register @babel/polyfill
npm i @babel/plugin-proposal-class-properties @babel/plugin-proposal-export-default-from @babel/plugin-syntax-dynamic-import @babel/preset-env --save-dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment