manfredsteyer / ngx-build-plus

Extend the Angular CLI's default build behavior without ejecting, e. g. for Angular Elements
1.19k stars 136 forks source link

npm run build:project:externals - Generating browser application bundles (phase: setup)...An unhandled exception occurred: Script file node_modules/rxjs/bundles/rxjs.umd.js does not exist. #349

Open dinbtechit opened 1 year ago

dinbtechit commented 1 year ago

npm run build:project:externals - Generating browser application bundles (phase: setup)...An unhandled exception occurred: Script file node_modules/rxjs/bundles/rxjs.umd.js does not exist.

npm run build:project:externals 

output:

⠋ Generating browser application bundles (phase: setup)...An unhandled exception occurred: Script file node_modules/rxjs/bundles/rxjs.umd.js does not exist.
See "/private/var/folders/8n/z0ncgbf563j_rrgrt15rsw_40000gn/T/ng-NGDCza/angular-errors.log" for further details.
⠦ Generating browser application bundles (phase: setup)...     <--<< STUCK IN THIS STEP.

/private/var/folders/8n/z0ncgbf563j_rrgrt15rsw_40000gn/T/ng-NGDCza/angular-errors.log

[error] Error: Script file node_modules/rxjs/bundles/rxjs.umd.js does not exist.
    at /project/myproject/node_modules/@angular-devkit/build-angular/src/webpack/utils/helpers.js:177:23
    at Array.reduce (<anonymous>)
    at globalScriptsByBundleName (/project/myproject/node_modules/@angular-devkit/build-angular/src/webpack/utils/helpers.js:169:58)
    at getCommonConfig (/project/myproject/node_modules/@angular-devkit/build-angular/src/webpack/configs/common.js:100:89)
    at async Promise.all (index 0)
    at async generateWebpackConfig (/project/myproject/node_modules/@angular-devkit/build-angular/src/utils/webpack-browser-config.js:64:22)
    at async generateBrowserWebpackConfigFromContext (/project/myproject/node_modules/@angular-devkit/build-angular/src/utils/webpack-browser-config.js:125:20)
    at async generateI18nBrowserWebpackConfigFromContext (/project/myproject/node_modules/@angular-devkit/build-angular/src/utils/webpack-browser-config.js:73:20)
    at async initialize (/project/myproject/node_modules/@angular-devkit/build-angular/src/builders/browser/index.js:71:70)
    at async SwitchMapSubscriber.project (/project/myproject/node_modules/@angular-devkit/build-angular/src/builders/browser/index.js:113:32)
FabianElsmer commented 1 year ago

This is a known issue

Angular 13 does not provide UMD bundles anymore, see also https://github.com/manfredsteyer/ngx-build-plus/issues/314

Angular 13 does not create this legacy UMD bundle format anymore, but there is a workaround to build the necessary bundles yourself: https://github.com/manfredsteyer/ngx-build-plus/issues/314#issuecomment-995302081

What I don't understand yet, is why use the UMD bundles at all, instead of using the MJS bundles Angular offers, I'm sure it has something to do with browser compatibility. Not sure if some changes in the build process would make it possible to use the MJS bundles directly without getting a broken main bundle back

I got the build working with Angular 13 today, let me know if you need help

divyaadurai commented 1 year ago

This is a known issue

Angular 13 does not provide UMD bundles anymore, see also #314

Angular 13 does not create this legacy UMD bundle format anymore, but there is a workaround to build the necessary bundles yourself: #314 (comment)

What I don't understand yet, is why use the UMD bundles at all, instead of using the MJS bundles Angular offers, I'm sure it has something to do with browser compatibility. Not sure if some changes in the build process would make it possible to use the MJS bundles directly without getting a broken main bundle back

I got the build working with Angular 13 today, let me know if you need help

@FabianElsmer, how did you made it work with Angular 13 ? Can you share the details ?