-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there a way to enable the allowTopLevelThis option? #3055
Comments
@GianlucaGuarini As mentioned already in that other issue, but would be invalid ES6. In ES6, JavaScript is treated in two ways, as a "script", or as a "module". Only "module"-type javascript may use Depending on your goals, I see two options:
|
Specifically for this problem, the babel-plugin-transform-es2015-modules-commonjs has introduced a plugin option "allowTopLevelThis". However, there is currently no way to pass a plugin configuration option to a preset (#2756) Regarding your options, is there a way to exclude babel-plugin-transform-es2015-modules-commonjs from the es2015 preset? Or would it require to create a custom preset? |
@loganfsmyth thanks for your answer I am just trying to find out whether babel 6 can consistently behave like the previous release using at least some options combined with its presets. Using a complicate list of presets just to solve this simple issue seems to me a bit an overkill also because this option is already there you just need to make it public somehow |
We have preset options now, we could add an option to modify the modules plugins. |
We have problems using babel 6 in our riot-compiler Is there a way to enable the
allowTopLevelThis
option?The text was updated successfully, but these errors were encountered: