build(plugins-config): hacky attempt to work around define.amd umd modules breaking runtime

This commit is contained in:
Jack Westbrook
2025-02-18 10:17:34 +01:00
parent 1a492a0eb8
commit c611c0bbd4
@@ -97,6 +97,20 @@ const config = async (env: Record<string, unknown>): Promise<Configuration> => {
},
],
},
// HACKS: Workaround for rspack not outputting UMD modules as webpack does.
// We have systemjs amd define which doesn't work like standard amd define so we need to disable it,
// in any umd module otherwise it will break at runtime.
{
test: [require.resolve('json-logic-js'), require.resolve('classnames')],
use: [
{
loader: require.resolve('imports-loader'),
options: {
additionalCode: 'var define = false; /* Disable AMD for misbehaving libraries */',
},
},
],
},
{
exclude: /(node_modules)/,
test: /\.[tj]sx?$/,
@@ -150,6 +164,7 @@ const config = async (env: Record<string, unknown>): Promise<Configuration> => {
},
output: {
clean: true,
filename: '[name].js',
library: {
type: 'amd',