I've tried everything i could find so far and i'm still getting the error "exports is not defined".
I am using ReactJS.NET (for NetCore2) and it is mandatory otherwise my entire app will not load under NetCore2.
This is my .babelrc
{
"presets": [
"@babel/preset-react",
"@babel/preset-env",
"@babel/preset-typescript"
],
"plugins": [
"add-module-exports",
"@babel/plugin-proposal-class-properties",
[
"@babel/plugin-transform-runtime",
{
"corejs": 2,
"helpers": true,
"regenerator": true,
"useESModules": true
}
]
]
}
Everything worked fine with the older babel and "add-module-exports". Is there an alternative for babel 7?
A couple of things:
add-module-exports
plugin.transform-es2015-modules-commonjs
plugin.Update
I did not notice that you are using
typescript
. In that case, you probably want to do this instead:1) Change your
.babelrc
to:2) make sure that your
tsconfig.json
has the following entry:"module": "commonjs",