Open s3ththompson opened 3 years ago
FWIW, I needed to make this change to src/node-config
to solve my problem:
require('babel-register')({
presets: ['env', 'stage-2', 'react'],
babelrc: false,
- only: isWindows ? undefined : new RegExp(`(${transformFolders.join('|')})`)
+ ignore: [/node_modules\/(?!three)/],
});
It looks like the problem is made a bit more difficult by the fact that there are two layers of babel transformation happening? Does babel-register
not respect other babelConfig?
Is your feature request related to a problem? Please describe. I can't build a component that imports an untranspiled ES module from a dependency. Three notoriously ships its examples (including OrbitControls, etc.) as untranspiled ESM. It looks like the undocumented
compileLibs
option is respected insrc/pipeline/bundle-js
but not insrc/node-config
.Describe the solution you'd like Ideally, idyll would allow extending the default babelConfig (perhaps similarly to how Next.js extends webpack config). This would allow userland solutions to my issue (transpiling an ES module from a dependency) but also other customization that might otherwise require adding and supporting additional flags.
Describe alternatives you've considered Even if the
compileLibs
option was extended to turn onnode_modules
transpilation everywhere, the solution would be inefficient as transpiling all dependencies is expensive. In my case, it is only one dependency (three
) which requires transpilation.Additional context I also tried to submit a simple PR to make
src/node-config
respectcompileLibs
by havingbabel-register
compilenode_modules
, but couldn't get the approach to work asidyll
has other dependencies innode_modules
that break when run throughbabel-register
.