diff --git a/playground/config-overrides.js b/playground/config-overrides.js index 37a217251..ba40e39ab 100644 --- a/playground/config-overrides.js +++ b/playground/config-overrides.js @@ -1,12 +1,50 @@ 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.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; + }, }; diff --git a/web-component/package.json b/web-component/package.json index fb580bf94..d8ab51dac 100644 --- a/web-component/package.json +++ b/web-component/package.json @@ -51,8 +51,8 @@ "web-react-components": "^1.4.2" }, "devDependencies": { - "@types/react": "^16.9.2", "ts-loader": "9.4.4", + "@types/react": "^16.9.2", "webpack": "5.88.2", "webpack-cli": "5.1.4" },