nx/packages/webpack/src/utils/web-babel-loader.ts
2022-09-12 21:19:50 +01:00

17 lines
550 B
TypeScript

module.exports = require('babel-loader').custom(() => {
return {
customOptions({ isModern, emitDecoratorMetadata, ...loader }) {
return {
custom: { isModern, emitDecoratorMetadata },
loader,
};
},
config(cfg, { customOptions: { isModern, emitDecoratorMetadata } }) {
// Add hint to our babel preset so it can handle modern vs legacy bundles.
cfg.options.caller.isModern = isModern;
cfg.options.caller.emitDecoratorMetadata = emitDecoratorMetadata;
return cfg.options;
},
};
});