Created
April 5, 2021 08:54
-
-
Save evasyuk/7a57cc554c63407d813db17a4d78212a to your computer and use it in GitHub Desktop.
Add babel support to index.js
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
.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