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

Externals schematics references non existend files (*.umd.js) #394

Open MickL opened 1 year ago

MickL commented 1 year ago

I am on Angular 16 and ng g ngx-build-plus:externals references files like node_modules/@angular/core/bundles/core.umd.js that do not exists anymore.

Error: Can't resolve 'node_modules/@angular/common/bundles/common-http.umd.js' in '/Users/mick/Documents/git/myproject'

Error: Can't resolve 'node_modules/@angular/common/bundles/common.umd.js' in '/Users/mick/Documents/git/myproject'

Error: Can't resolve 'node_modules/@angular/compiler/bundles/compiler.umd.js' in '/Users/mick/Documents/git/myproject'

Error: Can't resolve 'node_modules/@angular/core/bundles/core.umd.js' in '/Users/mick/Documents/git/myproject'

Error: Can't resolve 'node_modules/@angular/elements/bundles/elements.umd.js' in '/Users/mick/Documents/git/myproject'

Error: Can't resolve 'node_modules/@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js' in '/Users/mick/Documents/git/myproject'

Error: Can't resolve 'node_modules/@angular/platform-browser/bundles/platform-browser.umd.js' in '/Users/mick/Documents/git/myproject'

I tried to figure out the correct import but couldnt make it work yet. Does anyone have an idea?

The follow I tried but I get Cannot use import statement outside a module:

"scripts": [
              "node_modules/rxjs/dist/esm/rxjs.umd.js",
              "node_modules/@angular/core/fesm2022/core.mjs",
              "node_modules/@angular/common/fesm2022/common.mjs",
              "node_modules/@angular/common/fesm2022/http.mjs",
              "node_modules/@angular/compiler/fesm2022/compiler.mjs",
              "node_modules/@angular/elements/fesm2022/elements.mjs",
              "node_modules/@angular/platform-browser/fesm2022/platform-browser.mjs",
              "node_modules/@angular/platform-browser-dynamic/fesm2022/platform-browser-dynamic.mjs"
            ]
MickL commented 1 year ago

Found this issue where in the comments there seem to be a solution: https://github.com/manfredsteyer/ngx-build-plus/issues/314

In any case the Schematic is broken so either the Schematic needs to be removed or maybe we can find a different way of bundling.