3

As Angular 13 is not producing UMD-Bundles any longer

the command

ng g ngx-build-plus:externals --project MY_PROJECT

currently creates an invalid angular.json (pointing to the non-existing UMD-Bundles).

Here is umd bundles referred in angular.json

"scripts": [
              "node_modules/rxjs/bundles/rxjs.umd.js",
              "node_modules/@angular/core/bundles/core.umd.js",
              "node_modules/@angular/common/bundles/common.umd.js",
              "node_modules/@angular/common/bundles/common-http.umd.js",
              "node_modules/@angular/compiler/bundles/compiler.umd.js",
              "node_modules/@angular/elements/bundles/elements.umd.js",
              "node_modules/@angular/platform-browser/bundles/platform-browser.umd.js",
              "node_modules/@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js"
            ]

What is the alternate files for these above files? Is there any other way to solve this issue ?

2
  • 1
    I started a bounty to this, because I have the same issue since I updated from Angular 12 to Angular 14. When I run ng serve or ng build, I receive - Generating browser application bundles (phase: setup)...An unhandled exception occurred: Script file node_modules/rxjs/bundles/rxjs.umd.js does not exist. See "C:\Users\...\AppData\Local\Temp\ng-DDRwGT\angular-errors.log" for further details. \ Generating browser application bundles (phase: setup)... and the build then never finishes, it just gets stuck in generating the setup phase. Commented Sep 14, 2022 at 8:00
  • github.com/manfredsteyer/ngx-build-plus/issues/314 Commented Sep 20, 2022 at 21:25

1 Answer 1

2

As specified by the author of the package. Apparently, angular 13 no longer generates umd files; hence, the reason for the error.

He gave some sort of a workaround here by directly adding it to the window object and importing the required files.

window.ng.core = require('@angular/core');
window.ng.common = require('@angular/common');

Maybe we can add a file containing all the direct assignments to window.ng and add that to angular.json.

You can read his response here: https://github.com/manfredsteyer/ngx-build-plus/issues/314#issuecomment-1089107900

Sign up to request clarification or add additional context in comments.

2 Comments

I tried adding window.ng.... in my webpack.externals.js file and also creating a new file called window.js and added this file to the scripts array in angular.json. But it didn't help at all, I still receive the error: Script file node_modules/rxjs/bundles/rxjs.umd.js does not exist.
There is also a way how to generate umd files for Angular 13 with rollup - here is repo example github.com/peterblazejewicz/angular-umd-bundle But I had issue still with generating after that single-file with ngx-build-plus

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.