Meteor 3 legacy build includes modern javascript

I am unable to get a legacy build without modern js. I’ve tried a bunch of config files including .babelrc, .meteorconfig, .meteorrc, babel.config.js, meteor.config.js, and transpilation settings in package.json. I’m quite lost at this point. Looking for some solid direction on how to get a legacy build with no ES6 syntax.

If you can give more details about this, some from the community might be able to help:

  1. Do you have examples of code not transpiled correctly?

  2. What errors are you getting?

  3. Are you using the modern-browser package?

It seems to be node_modules which are not getting transpiled, particularly react libs like react-query. I have tried adding to the ‘recompile’ option in package.json like below, but it did not seem to change anything.

"meteor": {
  "mainModule": {
    "client": "client/main.tsx",
    "server": "server/main.ts"
  },
  "testModule": "tests/main.ts",
  "nodeModules": {
    "recompile": {
      "@tanstack/react-query": [
        "legacy",
        "client"
      ]
    }
  }
}

I do not use the modern-browser package, but so far I’m not having trouble targeting browsers with a legacy build, I’m just having trouble getting node_modules in my legacy build transpiled properly.

It seems you are not 100% sure that this package is the source of the error. How did you know that it came from this package?

I’m certain node_modules are at least part of the problem as the first error that causes the app to crash in legacy browsers is emanating from react-query. I can also find lots of es6 syntax in .meteor/local/build/programs/web.browser.legacy/packages/modules.js by simply searching for const, () => , ..., etc. I have not observed any issues with core meteor packages, thus my statement that the issue “seems” be related to node_modules.