Webpack build error

I started seeing this npm build error

i 「wds」: Project is running at
i 「wds」: webpack output is served from /client
i 「wds」: Content not from webpack is served from C:\Users\Ryan\projects\colossum\client\public
i 「wds」: 404s will fallback to /client/
Starting the development server...

Failed to compile.

./node_modules/@babylonjs/core/Misc/environmentTextureTools.js 100:39
Module parse failed: Unexpected token (100:39)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
|   }
>   const imageType = options.imageType ?? DefaultEnvironmentTextureImageType;
|   const engine = internalTexture.getEngine();

I’ve read through some similar posts in these forums and it seems likely there’s some configuration I’m missing or something else small but hard to guess at - does anyone have an idea where to start looking?

It’s the “null coalescing operator” that you need to configure babel for. I wonder why Babylon doesn’t target an older ES version, since lots of people have issues.

so just install a babel plugin like so:

npm i --save-dev @babel/plugin-proposal-nullish-coalescing-operator

and then updating the babel.rc plugin with the plugin?

  "plugins": [..., "@babel/plugin-proposal-nullish-coalescing-operator"]

cc @RaananW

1 Like

Hi @arcman7,

I see that you’re using Webpack. What version of Webpack are you using?
If it’s v4 the simplest solution would be to upgrade to v5.

The issue looks similar to this one


I was on webpack version 4, I’ve updated it to version "5.74.0" via updating my “react-scripts” package:
npm i react-scripts

It’s just frameworks all the way down lol

It appears this is working, thank you!


I’ll add this just for completeness -

Upgrading from webpack 4 → 5 requires you to start handling missing core node modules:

Tbh, I did all this just so I could keep Ammo.js in my npm packages.json (it uses require('fs'), but I’m not sure of a better way to get around this.

1 Like