razzle icon indicating copy to clipboard operation
razzle copied to clipboard

Invert config loading in babel-loader, pass caller to config

Open fivethreeo opened this issue 3 years ago • 3 comments
trafficstars

https://github.com/jaredpalmer/razzle/blob/alpha/packages/razzle-babel-loader/src/loader/get-config.ts#L179

fivethreeo avatar Feb 08 '22 15:02 fivethreeo

Set babelrc to true and call loadPartialConfig, later set to false and call loadPartialConfig again

fivethreeo avatar Feb 08 '22 15:02 fivethreeo

Cached Babel config loading will be per filetype, module type, razzle target. So only toplevel Babel config works. If relative ones are found before they will be cached instead

fivethreeo avatar Apr 03 '22 23:04 fivethreeo

Pass a minimal options with caller to loadPartialConfig first with babelrc set to true. Add a option to babel-loader to say if we want the loader to add plugins. Possibly allow prepend, append or replace so it easy to not get in the way of customizations.

then pass the options to loadOptions and then to loadPartialConfig again.

fivethreeo avatar Apr 03 '22 23:04 fivethreeo