idyll-lang/idyll

Allow babelConfig to be extended by user (or support compileLibs everywhere)

Open

#667 opened on Sep 22, 2020

View on GitHub
 (1 comment) (0 reactions) (0 assignees)JavaScript (1,977 stars) (97 forks)batch import
CLIFeature Requesthelp wanted

Description

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 in src/pipeline/bundle-js but not in src/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 on node_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 respect compileLibs by having babel-register compile node_modules, but couldn't get the approach to work as idyll has other dependencies in node_modules that break when run through babel-register.

Contributor guide