just-jeb / angular-builders

Angular build facade extensions (Jest and custom webpack configuration)
MIT License
1.14k stars 198 forks source link

Compilation errors after upgrade to Angular 16 #1475

Closed slh-swisslog closed 12 months ago

slh-swisslog commented 1 year ago

Describe the Bug

I have an application that loads MD, HTML, and TS files at runtime to display sample usage code for other developers. The same custom webpack configuration worked with Ng14 and Ng15 but fails to build after upgrading to Ng16. I tried both @angular-builders/custom-webpack 16.0.0 and 16.0.1.

Minimal Reproduction

https://github.com/shuppert/CustomWebpackNg15 https://github.com/shuppert/CustomWebpackNg16

Expected Behavior

The code should build under Ng16 the same as it did under prior versions.

Screenshots

image image

Environment


Libs
- @angular/core version: 16.2.4
- @angular-devkit/build-angular version: 16.2.1
- @angular-builders/custom-webpack:browser version: 16.0.1

For Tooling issues:
- Node version: 18.17.1
- Platform:  Windows

shuppert commented 1 year ago

FWIW I figured it out. The fix was to change the way the import with a promise to a require.

import(`../${this.name}/${this.name}.component.html?raw`).then((res) => {

was replaced with: const html = require(`../${this.name}/${this.name}.component.html?raw`);

arturovt commented 12 months ago

This is not an issue with Angular builders itself, but rather a third-party configuration problem. Better avenue for support is StackOverflow, but since this is an issue tracker and not a support forum, this issue will be closed.