# Docker Production Webpack 5 Build Problem

**URL:** https://discourse.aurelia.io/t/docker-production-webpack-5-build-problem/5189
**Category:** Help Requests
**Created:** [June 26, 2023, 4:52am UTC](https://discourse.aurelia.io/t/docker-production-webpack-5-build-problem/5189 "2023-06-26T04:52:22Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![ArchEnemy](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/archenemy/32/2445_2.png) [@ArchEnemy](https://discourse.aurelia.io/u/ArchEnemy)
#### Post date: [June 26, 2023, 4:52am UTC](https://discourse.aurelia.io/t/docker-production-webpack-5-build-problem/5189/1 "2023-06-26T04:52:22Z")

</div>

This is so painful to debug. For some reason production build works just fine in my project using Node Cmd Prompt (Windows). But as soon as you use Docker using the node Docker Image. Aurelia production build gives off a lot of failures and typescript errors during compilation.

I tried multiple versions of Webpack, multiple versions of Node (including many older versions). It’s not quite clear why it works fine to run and build prod in Cmd prompt but not within a docker image and then hosting it on nginx as an index.html. These things worked just fine in Au1 and many different articles exist online of people doing this with many other frameworks without issue

**They look a lot like this (21+ errors).:** (but goes on for a while)

```auto
ERROR in /app/src/components/front-page.ts
./src/components/front-page.ts 4:9-16
[tsl] ERROR in /app/src/components/front-page.ts(4,10)
      TS2614: Module '"aurelia"' has no exported member 'IRouter'. Did you mean to use 'import IRouter from "aurelia"' instead?
 @ ./src/components/index.ts 11:0-29 11:0-29
 @ ./src/my-app.ts 10:0-101 19:19-31 24:19-33 30:19-34 36:19-30 42:19-28
 @ ./src/main.ts 6:0-33 19:9-14

ERROR in /app/src/components/front-page.ts
./src/components/front-page.ts 4:18-33
[tsl] ERROR in /app/src/components/front-page.ts(4,19)
      TS2614: Module '"aurelia"' has no exported member 'IRouteViewModel'. Did you mean to use 'import IRouteViewModel from "aurelia"' instead?
 @ ./src/components/index.ts 11:0-29 11:0-29

webpack 5.88.0 compiled with 21 errors in 7392 ms
The command '/bin/sh -c npm run build' returned a non-zero code: 1

```

---

<div class="post-metadata">

### Author: ![bigopon](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/bigopon/32/18_2.png) [@bigopon](https://discourse.aurelia.io/u/bigopon)
#### Post date: [June 26, 2023, 5:24am UTC](https://discourse.aurelia.io/t/docker-production-webpack-5-build-problem/5189/2 "2023-06-26T05:24:24Z")

</div>

likely you are having different dependency restoration results. Maybe check your lock file to see if it’s got through properly, also your dependencies in package json whether it’s pinned to a specific version.

Note on the error: we used to export `IRouter` from `aurelia` package, but now not anymore. Hence I suspect your dependencies resolution got wacked.

---

<div class="post-metadata">

### Author: ![ArchEnemy](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/archenemy/32/2445_2.png) [@ArchEnemy](https://discourse.aurelia.io/u/ArchEnemy)
#### Post date: [June 27, 2023, 5:45am UTC](https://discourse.aurelia.io/t/docker-production-webpack-5-build-problem/5189/3 "2023-06-27T05:45:12Z")

</div>

But shouldn’t deleting the package lock fix the problem? I’m able to compile prod version locally with webpack 5.88 interestingly using npm start build. I’ve tried deleting package-lock and making sure docker doesn’t copy over the package-lock like it was doing before.

I even put everything in dependencies rather than devDependencies just in case.

When you remove the lock file, it should try to recreate it with the latest should it not?

```auto
"dependencies": {
    "@aurelia/validation": "latest",
    "@aurelia/validation-html": "^2.0.0-alpha.40",
    "@aurelia/webpack-loader": "latest",
    "@aurelia/testing": "latest",
    "@aurelia/ts-jest": "latest",
    "aurelia": "latest",
    "ts-loader": "^9.3.0",
    "typescript": "^4.7.3",
    "tslib": "^2.4.0",
    "css-loader": "^6.7.1",
    "dotenv-webpack": "^7.1.0",
    "eslint": "^8.17.0",

```

Any of these versions look off?? I’ve mostly avoided changing anything in package.json manually.

If I check npm list:

```auto
+-- aurelia@2.0.0-alpha.40

```

Most of the Aurelia ones are alpha.40.

I checked npm version on docker as well vs the node I have.

What library is producing the errors? Is it just aurelia versions or typescript versions? There must be a reason why it’s working locally in cmd prompt but not in docker linux.

---

<div class="post-metadata">

### Author: ![bigopon](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/bigopon/32/18_2.png) [@bigopon](https://discourse.aurelia.io/u/bigopon)
#### Post date: [June 28, 2023, 11:27pm UTC](https://discourse.aurelia.io/t/docker-production-webpack-5-build-problem/5189/4 "2023-06-28T23:27:56Z")

</div>

```ts
    "@aurelia/validation": "latest",
    "@aurelia/validation-html": "^2.0.0-alpha.40",
    "@aurelia/webpack-loader": "latest",
    "@aurelia/testing": "latest",
    "@aurelia/ts-jest": "latest",

```

Change to

```ts
    "@aurelia/validation": "2.0.0-alpha.40",
    "@aurelia/validation-html": "2.0.0-alpha.40",
    "@aurelia/webpack-loader": "2.0.0-alpha.40",
    "@aurelia/testing": "2.0.0-alpha.40",
    "@aurelia/ts-jest": "2.0.0-alpha.40",

```

---

<div class="post-metadata">

### Author: ![ArchEnemy](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/archenemy/32/2445_2.png) [@ArchEnemy](https://discourse.aurelia.io/u/ArchEnemy)
#### Post date: [July 4, 2023, 2:53am UTC](https://discourse.aurelia.io/t/docker-production-webpack-5-build-problem/5189/5 "2023-07-04T02:53:13Z")

</div>

omg why didn’t I think of that. I just assumed since they are different modules that it’s ok to mix and match but that makes sense in alpha that wouldn’t be the case when there is a beta out. I also assumed modules check dependency of each others’ versions.

I should have checked [aurelia - npm](https://www.npmjs.com/package/aurelia?activeTab=versions)

You are amazing!
