# Webpack build error

**URL:** <https://forum.babylonjs.com/t/webpack-build-error/34118>\
**Category:** Questions\
**Tags:** node, typescript, webpack\
**Created:** [September 21, 2022, 8:41pm UTC](https://forum.babylonjs.com/t/webpack-build-error/34118 "2022-09-21T20:41:08Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![arcman7](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/arcman7/32/20249_2.png) [@arcman7](https://forum.babylonjs.com/u/arcman7)\
**Post date:** [September 21, 2022, 8:41pm UTC](https://forum.babylonjs.com/t/webpack-build-error/34118/1 "2022-09-21T20:41:08Z")

</div>

I started seeing this npm build error

```auto
i ｢wds｣: Project is running at http://172.24.144.1/
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?

---

<div class="post-metadata">

**Author:** ![brianzinn](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/brianzinn/32/28013_2.png) [@brianzinn](https://forum.babylonjs.com/u/brianzinn)\
**Post date:** [September 21, 2022, 8:47pm UTC](https://forum.babylonjs.com/t/webpack-build-error/34118/2 "2022-09-21T20:47:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![arcman7](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/arcman7/32/20249_2.png) [@arcman7](https://forum.babylonjs.com/u/arcman7)\
**Post date:** [September 21, 2022, 9:00pm UTC](https://forum.babylonjs.com/t/webpack-build-error/34118/3 "2022-09-21T21:00:43Z")

</div>

so just install a babel plugin like so:

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

```

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

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

```

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [September 21, 2022, 9:07pm UTC](https://forum.babylonjs.com/t/webpack-build-error/34118/4 "2022-09-21T21:07:19Z")

</div>

cc @RaananW

---

<div class="post-metadata">

**Author:** ![neu5](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/neu5/32/24720_2.png) [@neu5](https://forum.babylonjs.com/u/neu5)\
**Post date:** [September 21, 2022, 9:08pm UTC](https://forum.babylonjs.com/t/webpack-build-error/34118/5 "2022-09-21T21:08:29Z")

</div>

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

> [@Webpack will not compile myn application after upgrade from babylon 5.21.0 to the 5.22.0](https://forum.babylonjs.com/t/webpack-will-not-compile-myn-application-after-upgrade-from-babylon-5-21-0-to-the-5-22-0/33597):
>
> I cannot get my setup to work as before nothing has changed, I have just upgraded the babylon.js dependencies from a 5.21.0. to 5.22.0 and then I have all these errors about missing loaders.

---

<div class="post-metadata">

**Author:** ![arcman7](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/arcman7/32/20249_2.png) [@arcman7](https://forum.babylonjs.com/u/arcman7)\
**Post date:** [September 21, 2022, 9:20pm UTC](https://forum.babylonjs.com/t/webpack-build-error/34118/6 "2022-09-21T21:20:48Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![arcman7](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/arcman7/32/20249_2.png) [@arcman7](https://forum.babylonjs.com/u/arcman7)\
**Post date:** [September 21, 2022, 9:48pm UTC](https://forum.babylonjs.com/t/webpack-build-error/34118/7 "2022-09-21T21:48:32Z")

</div>

I’ll add this just for completeness -

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

> **[Alchemy - the web3 development platform](https://www.alchemy.com/blog/how-to-polyfill-node-core-modules-in-webpack-5)**
>
> Whether you're a beginner developer, startup, web3 market leader, or a large enterprise, Alchemy makes multichain web3 development easy with reliable and scalable node infrastructure, enhanced APIs, and developer tools. Get started for free!

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.
