I believe I tried something similar already. First I tried to pass it to babel.
import { defineConfig } from '@meteorjs/rspack'
// eslint-disable-next-line no-unused-vars
export default defineConfig(Meteor => ({
builtins: {
// enable React/JSX handling in rspack (SWC-backed)
react: {
runtime: "automatic", // or "classic"
development: Meteor.isDevelopment,
importSource: "react"
}
},
module: {
rules: [
// 1) Preprocess Flow: run babel-loader first to strip Flow types
{
enforce: "pre", // run before other loaders / built-in parsing
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
options: {
babelrc: false,
presets: [
"@babel/preset-flow",
"@babel/preset-react" // keeps JSX-compatible for any files handled by babel
]
}
}
},
// 2) TypeScript (+ JSX in .tsx)
{
test: /\.(ts|tsx)$/,
type: "tsx" // tells rspack to parse TS + JSX (SWC)
},
// 3) JS / JSX - let rspack's built-in JS parser (SWC) handle remaining .js/.jsx
{
test: /\.(js|jsx)$/,
// 'type: "jsx"' enables JSX parsing/transforms via SWC
type: "jsx",
exclude: /node_modules/ // I also treid with excluding everything but my NPM of interest.
}
]
},
resolve: {
extensions: [".ts", ".tsx", ".js", ".jsx", ".json"]
}
}))
I also tried something like this:
import { defineConfig } from '@meteorjs/rspack'
// eslint-disable-next-line no-unused-vars
// (Same imports as earlier)
export default defineConfig(Meteor => {
return {
// Exclude native modules from the bundle (use Meteor runtime)
...Meteor.compileWithMeteor(['node_modules/@act/toastr-component/index.js']),
}
})
but then I tried this:
import { defineConfig } from '@meteorjs/rspack'
// eslint-disable-next-line no-unused-vars
// (Same imports as earlier)
export default defineConfig(Meteor => {
return {
module: {
rules: [
{
test: /\.jsx?$/, // Target both .js and .jsx files
use: {
loader: 'builtin:swc-loader',
options: {
jsc: {
parser: {
syntax: 'ecmascript',
jsx: true, // Enable JSX parsing
},
},
},
},
type: 'javascript/auto',
},
// ... other rules (e.g., for .tsx files)
],
}
}
})
They all yield the same error.
Then I used your configuration @schlaegerz and I am getting a different error which was reported by @wreiske here: GitHub · Where software is built
I tried transpiler options in package.json of the project
"modern": {
"transpiler": {
"exclude": "/node_modules/@act/toastr-component",
"excludeNodeModules": true
}
},
I finally killed the package and moved it in the main project as a regular React component. It compiled nicely but … now, with no errors, the page is not loading.
I spent more than 12 hours cumulated in multiple weeks trying to debug this, but I think I need to park this indefinitely. I am not sure this is going to work for me, the Meteor build now is a Frankenstein of babel, swc, webpack, rspack and I just don’t understand it and I don’t know which docs to use, when, in what context, which part comes from which tech, which settings to use where and where to take them from … etc.







