babel/packages/babel-standalone/src/dynamic-require-entrypoint.cjs
Nicolò Ribaudo 8e7a164490
Make sure that Rollup's dynamicRequireTargets are included (#12839)
* Make sure that Rollup's `dynamicRequireTargets` are included

* Update packages/babel-standalone/src/dynamic-require-entrypoint.cjs

Co-authored-by: Brian Ng <bng412@gmail.com>
2021-02-21 22:32:50 +01:00

14 lines
538 B
JavaScript

/*
We bundle @babel/standalone using the dynamicRequireTargets option.
This option needs to inject require() calls to all the modules that
could be dynamically required later.
By default it injects them in the entrypoint, but when rollup loads the
entrypoint it finds syntax that it doesn't support (because
@rollup/plugin-commonjs must run before @rollup/plugin-babel).
We use "yarn patch" to modify the @rollup/plugin-commonjs package, so
that it injects those "preload" require() calls in this file rather
than in the entrypoint.
*/