Esm: Babel 7 beta >=56 with transpiling to CJS: "yield is a reserved word in strict mode"

Created on 28 Aug 2018  ·  5Comments  ·  Source: standard-things/esm

Happens on different random files under the different conditions:

"main";_01f‍.x([["babelConfigWebDemo",()=>babelConfigWebDemo],["babelConfigWebStatic",()=>babelConfigWebStatic],["babelConfigWebBuild",()=>babelConfigWebBuild],["babelConfigReactNativeBuild",()=>babelConfigReactNativeBuild],["babelConfigNodeBuild",()=>babelConfigNodeBuild]]);let babelPresetReactNative;_01f‍.w("babel-preset-react-native",[["default",["babelPresetReactNative"],function(v){babelPresetReactNative=v}]]);yield;
"main";let plugin;_255‍.w("@start/plugin",[["default",["plugin"],function(v){plugin=v}]]);yield;

I believe that yield at the end has been added by ESM loader and when Babel is applying babel/plugin-transform-modules-commonjs (I still have to build some files without modules: false) it contains "use strict".

Please let me know if it's still unclear: unfortunately I can't provide a repro-repo because the error is kinda phantom.

bug

Most helpful comment

All 5 comments

Are you using @babel/register? If not you should be ignoring the .cache folder in transforms. I'll see if I can avoid storing the actual transform yield bit though.

Yes, it's @babel/register.

I need to pay off some test debt before bumping. You can expect a release in a day or so.

Update:

Tests https://github.com/standard-things/esm/commit/e69ea6879d24ec0e7a9feb9baeee19d6c8b5bc8d.

Update:

v3.0.81 is released :tada:

Was this page helpful?
0 / 5 - 0 ratings