ERR_REQUIRE_ESM in build (since update from 2.2 to 2.3.2) (meteor run works)


after updating from Meteor 2.2 into 2.3.2, I ran into an issue with the dependency “react-bootstrap” in version “1.6.1” respectively 2.0.0-beta*. Version 1.6.1 would be the correct one, for my bootstrap4 based theme, but that does currently not work. Obviously there seem to be a change in that library, but more important seems to me the discrepancy between the two runtime-environments (“meteor run” and “node”).

To be precise: v1.6.1 does work during normal development mode with “meteor run”. But when I build it (“meteor build” works without errors, results have comparable sizes and structure), run “npm install” (inside bundle/programs/server) and start it with “PORT=3000 ROOT_URL=http://localhost MONGO_URL=mongodb://localhost:27017/asdf-02 METEOR_SETTINGS=$(cat /home/asdf/asdf/settings.json) node bundle/main.js” the following error occurs:


Error [ERR_REQUIRE_ESM] [ERR_REQUIRE_ESM]: Must use import to load ES Module: /home/asdf/asdf_161/bundle/programs/server/npm/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js
require() of ES modules is not supported.
require() of /home/asdf/asdf_161/bundle/programs/server/npm/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js from /home/asdf/asdf_161/bundle/programs/server/npm/node_modules/react-bootstrap/esm/Modal.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename objectWithoutPropertiesLoose.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /home/asdf/asdf_161/bundle/programs/server/npm/node_modules/@babel/runtime/helpers/esm/package.json.

    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1089:13)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Module.Mp.load (/home/asdf/asdf_161/bundle/programs/server/runtime.js:46:33)
    at Function.Module._load (internal/modules/cjs/loader.js:778:12)
    at Module.require (internal/modules/cjs/loader.js:961:19)
    at Module.moduleLink [as link] (/home/asdf/asdf_161/bundle/programs/server/node_modules/reify/lib/runtime/index.js:52:22)
    at Object.<anonymous> (/home/asdf/asdf_161/bundle/programs/server/npm/node_modules/react-bootstrap/esm/Modal.js:1:-7)
    at Module._compile (internal/modules/cjs/loader.js:1072:14)
    at Module.Mp._compile (/home/asdf/asdf_161/bundle/programs/server/runtime.js:99:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Module.Mp.load (/home/asdf/asdf_161/bundle/programs/server/runtime.js:46:33)
    at Function.Module._load (internal/modules/cjs/loader.js:778:12)
    at Module.require (internal/modules/cjs/loader.js:961:19)
    at require (internal/modules/cjs/helpers.js:92:18)
    at npmRequire (/home/asdf/asdf_161/bundle/programs/server/npm-require.js:133:12)
    at Module.useNode (packages/modules-runtime.js:664:18)
    at module (packages/modules.js:1993:8)
    at fileEvaluate (packages/modules-runtime.js:336:7)
    at Module.require (packages/modules-runtime.js:238:14)
    at Module.moduleLink [as link] (/home/asdf/asdf_161/bundle/programs/server/npm/node_modules/meteor/modules/node_modules/reify/lib/runtime/index.js:52:22)
    at module (packages/asdf:shared-components/client/LoginModal.tsx:1:14) {

The same setup cleanly runs with “react-bootstrap”: “2.0.0-beta5”, both in development mode and the created build. Unfortunately that version does not fit my needs (I need the 1.x versions fpr bootstrap4) and I just faced the first bug in the UI.
A diff between those two versions of that lib can be analyzed here: github and I don’t see a change in “type”:“module” as printed on the stacktrace.

Meteor version of that project is currently 2.3.4.
With the update of Meteor from 2.2 to 2.3.2 this error and stacktrace was observed first. So I was forced to update react-bootstrap to v2*, with that version the project was again able to produce a runnable build.

I use node via nvm in version 14.17.4, my installed “npm version”:

  npm: '6.14.14',
  ares: '1.17.1',
  brotli: '1.0.9',
  cldr: '39.0',
  icu: '69.1',
  llhttp: '2.1.3',
  modules: '83',
  napi: '8',
  nghttp2: '1.42.0',
  node: '14.17.4',
  openssl: '1.1.1k',
  tz: '2021a',
  unicode: '13.0',
  uv: '1.41.0',
  v8: '8.4.371.23-node.76',
  zlib: '1.2.11'

I don’t have babel-configuration in this project.
My code is written in typescript, but currently I don’t see a connection to that error.
Any help appreciated, thanks for reading.