diff --git a/playground/config-overrides.js b/playground/config-overrides.js index 37a217251..55de206e5 100644 --- a/playground/config-overrides.js +++ b/playground/config-overrides.js @@ -1,12 +1,51 @@ const path = require('path'); -module.exports = function override(config, env) { - config.resolve = { - ...config.resolve, - ...{ - modules: [path.resolve(__dirname, 'node_modules'), 'node_modules'], - }, - }; - - return config; +module.exports = { + webpack: function(config, env) { + config.plugins; + config.module.rules = config.module.rules.map(rootRule => { + if (rootRule.oneOf) { + rootRule.oneOf = rootRule.oneOf.map(rule => { + if ((rule.loader ?? '').includes('babel-loader/lib/index.js')) { + rule.use = [ + path.join( + __dirname, + '../library/loaders/remove-hashbag-loader.js', + ), + { + loader: rule.loader, + options: { + ...rule.options, + plugins: [ + ...(rule.options.plugins ?? []), + '@babel/plugin-proposal-class-properties', + ], + }, + }, + ]; + delete rule.loader; + delete rule.options; + } + return rule; + }); + } + return rootRule; + }); + config.resolve = { + ...config.resolve, + ...{ + alias: { + 'nimma/legacy$': path.resolve( + __dirname, + 'node_modules/nimma/dist/legacy/cjs/index.js', + ), + 'nimma/fallbacks$': path.resolve( + __dirname, + 'node_modules/nimma/dist/cjs/fallbacks/index.js', + ), + }, + }, + }; + return config; + }, };