angular / angular-cli

CLI tool for Angular
https://cli.angular.io
MIT License
26.73k stars 11.98k forks source link

--experimentalRollupPass feedback issue #15836

Closed filipesilva closed 3 years ago

filipesilva commented 4 years ago

Heya all,

In https://github.com/angular/angular-cli/pull/15690 we introduced a new experimental flag, ----experimentalRollupPass, that attempts an advanced optimization pass. It's marked experimental because we don't expect it to work out of the box for all projects.

If you try it and it causes your project to fail to build, or to fail at runtime, please provide us with information here so we can try to address it.

The optimization aims at improving tree-shaking and dead code elimination efficiency for applications that use code splitting and code lazy loading. In our early experiments with some of our apps we've seen significant XX% code size reduction (depending on the app and various factors).

If you do experiment with this setting please post before and after payload size numbers + the output of ng version. thanks!

Docs: https://v9.angular.io/cli/build

filipesilva commented 4 years ago

@Splaktar PM'd me this error on the material website:

The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten

ERROR in ./src/main.ts
Module build failed (from ./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/webpack-rollup-loader.js):
Error: 'default' is not exported by node_modules/moment/moment.js
    at error (/Users/splaktar/Git/angular/material.angular.io/node_modules/rollup/dist/rollup.js:10151:30)
    at Module.error (/Users/splaktar/Git/angular/material.angular.io/node_modules/rollup/dist/rollup.js:14137:9)
    at handleMissingExport (/Users/splaktar/Git/angular/material.angular.io/node_modules/rollup/dist/rollup.js:14056:21)
    at Module.traceVariable (/Users/splaktar/Git/angular/material.angular.io/node_modules/rollup/dist/rollup.js:14448:17)
    at ModuleScope.findVariable (/Users/splaktar/Git/angular/material.angular.io/node_modules/rollup/dist/rollup.js:13146:39)
    at Identifier$1.bind (/Users/splaktar/Git/angular/material.angular.io/node_modules/rollup/dist/rollup.js:9217:40)
    at LogicalExpression.bind (/Users/splaktar/Git/angular/material.angular.io/node_modules/rollup/dist/rollup.js:7969:23)
    at LogicalExpression.bind (/Users/splaktar/Git/angular/material.angular.io/node_modules/rollup/dist/rollup.js:11882:15)
    at VariableDeclarator.bind (/Users/splaktar/Git/angular/material.angular.io/node_modules/rollup/dist/rollup.js:7969:23)
    at VariableDeclaration$1.bind (/Users/splaktar/Git/angular/material.angular.io/node_modules/rollup/dist/rollup.js:7965:31)
    at Program$1.bind (/Users/splaktar/Git/angular/material.angular.io/node_modules/rollup/dist/rollup.js:7965:31)
    at Module.bindReferences (/Users/splaktar/Git/angular/material.angular.io/node_modules/rollup/dist/rollup.js:14108:18)
    at Graph.link (/Users/splaktar/Git/angular/material.angular.io/node_modules/rollup/dist/rollup.js:17679:20)
    at /Users/splaktar/Git/angular/material.angular.io/node_modules/rollup/dist/rollup.js:17537:18
    at processTicksAndRejections (internal/process/task_queues.js:89:5)
 @ multi ./src/main.ts main[0][0[39mm
surajtambe commented 4 years ago

@filipesilva Please find my observations

  1. If any project used javascript library, same will fail to export var paramters as its not class. In my case : Chartjs ng2-charts fails . as chartjs declared chart object as var. so if any js library is used it will fail to compile.

ERROR in ./src/main.ts Module build failed (from C:/Users/Sngeo/git/sngeo/node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/webpack-rollup-loader.js): Error: 'Chart' is not exported by node_modules\chart.js\dist\Chart.js at error (node_modules\rollup\dist\rollup.js:5325:30) at Module.error (node_modules\rollup\dist\rollup.js:9557:9) at handleMissingExport \node_modules\rollup\dist\rollup.js:9476:21) at Module.traceVariable (\node_modules\rollup\dist\rollup.js:9870:17) at ModuleScope.findVariable (node_modules\rollup\dist\rollup.js:8543:39) at ReturnValueScope.findVariable (node_modules\rollup\dist\rollup.js:3040:38) at ChildScope.findVariable (node_modules\rollup\dist\rollup.js:3040:38) at ChildScope.findVariable (node_modules\rollup\dist\rollup.js:3040:38) at FunctionScope.findVariable (node_modules\rollup\dist\rollup.js:3040:38) at ChildScope.findVariable (node_modules\rollup\dist\rollup.js:3040:38) at FunctionScope.findVariable (node_modules\rollup\dist\rollup.js:3040:38) at ChildScope.findVariable (node_modules\rollup\dist\rollup.js:3040:38) at Identifier$1.bind (node_modules\rollup\dist\rollup.js:4376:40)
at NewExpression.bind (node_modules\rollup\dist\rollup.js:3127:23)
at NewExpression.bind (node_modules\rollup\dist\rollup.js:7809:15)
at AssignmentExpression.bind (node_modules\rollup\dist\rollup.js:3127:23) @ multi ./src/main.ts main[0] error Command failed with exit code 1.

  1. Second issue i found with v9.0.0-next.9 it failed to copy assets folder after build with --experimentalRollupPass=false in angular.json --> build --> assets as below "assets": [ "apps/xx/src/favicon.ico", "apps/xx/src/favicon.png", "apps/xx/src/sitemap.xml", "apps/xx/src/robots.txt", "apps/xx/src/manifest.json", "apps/xx/src/assets" ], assets folder includes other folders like img, etc...
naveedahmed1 commented 4 years ago

With 9.0.0-next.10 and below configuration:

              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "commonChunk": false,
              "experimentalRollupPass": true,

It throws below error:

D:\ClientApp>ng build --prod
69% building 1075/1076 modules 1 active ...\ClientApp\node_modules\@ngtools\webpack\src\index.js!D:\ClientApp\src\main.tsThe 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten
The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten
The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten
The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten
The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten
The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten
The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten

ERROR in ./src/main.ts
Module build failed (from ./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/webpack-rollup-loader.js):
Error: 'default' is not exported by node_modules\firebase\app\dist\index.cjs.js
    at error (E:\Web\Mustakbil\V 10.22\MustakbilClientApp\node_modules\@angular-devkit\build-angular\node_modules\rollup\dist\rollup.js:5325:30)
    at Module.error (D:\ClientApp\node_modules\@angular-devkit\build-angular\node_modules\rollup\dist\rollup.js:9557:9)
    at handleMissingExport (D:\ClientApp\node_modules\@angular-devkit\build-angular\node_modules\rollup\dist\rollup.js:9476:21)
    at Module.traceVariable (D:\ClientApp\node_modules\@angular-devkit\build-angular\node_modules\rollup\dist\rollup.js:9870:17)
    at ModuleScope.findVariable (D:\ClientApp\node_modules\@angular-devkit\build-angular\node_modules\rollup\dist\rollup.js:8543:39)
    at FunctionScope.findVariable (D:\ClientApp\node_modules\@angular-devkit\build-angular\node_modules\rollup\dist\rollup.js:3040:38)
    at ChildScope.findVariable (D:\ClientApp\node_modules\@angular-devkit\build-angular\node_modules\rollup\dist\rollup.js:3040:38)
    at MemberExpression.bind (D:\ClientApp\node_modules\@angular-devkit\build-angular\node_modules\rollup\dist\rollup.js:7379:49)
    at CallExpression$1.bind (D:\ClientApp\node_modules\@angular-devkit\build-angular\node_modules\rollup\dist\rollup.js:3127:23)
    at CallExpression$1.bind (D:\ClientApp\node_modules\@angular-devkit\build-angular\node_modules\rollup\dist\rollup.js:6273:15)
    at MemberExpression.bind (D:\ClientApp\node_modules\@angular-devkit\build-angular\node_modules\rollup\dist\rollup.js:3127:23)
    at MemberExpression.bind (D:\ClientApp\node_modules\@angular-devkit\build-angular\node_modules\rollup\dist\rollup.js:7397:19)
    at VariableDeclarator.bind (D:\ClientApp\node_modules\@angular-devkit\build-angular\node_modules\rollup\dist\rollup.js:3127:23)
    at VariableDeclaration$1.bind (D:\ClientApp\node_modules\@angular-devkit\build-angular\node_modules\rollup\dist\rollup.js:3123:31)
    at BlockStatement$1.bind (D:\ClientApp\node_modules\@angular-devkit\build-angular\node_modules\rollup\dist\rollup.js:3123:31)
    at FunctionDeclaration.bind (D:\ClientApp\node_modules\@angular-devkit\build-angular\node_modules\rollup\dist\rollup.js:3127:23)
 @ multi ./src/main.ts main[0]

If I remove below options from above configs:

"commonChunk": false,
              "experimentalRollupPass": true,

Then used ng build --prod --experimentalRollupPass=true it build without any error. And in this case the js bundle size decreased from 4.44mb to 4.29mb.

For ssr it seems that this options isn't support since it throws below error:

Unknown option: '--experimentalRollupPass'

cexbrayat commented 4 years ago
  1. For those running into an issue with import * as moment from 'moment'; looking like:
Module build failed (from ./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/webpack-rollup-loader.js):
Error: Cannot call a namespace ('moment')

I managed to get around it by importing it as:

import * as moment_ from 'moment';
const moment = moment_;
  1. I'm also running into a problem with Chart.js:
import { Chart } from 'chart.js';

throws:

Module build failed (from ./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/webpack-rollup-loader.js):
Error: 'Chart' is not exported by node_modules/chart.js/dist/Chart.js

This looks harder to fix (see this old issue by rollup's author himself https://github.com/rollup/rollup-plugin-commonjs/issues/159). This issue looks kind of common with CommonJS, it is even mentionned in the official troubleshooting guide. The recommended solution would be to specify namedExports as mentionned here.

But Filipe has a smarter idea, so the best is probably to wait for it 🙂

filipesilva commented 4 years ago

I'm not a big fan of listing exports, because it is onerous and unexpected for users to have to understand the shape of imported dependencies and transitive dependencies. This was part of the reason we moved from SystemJS to Webpack back in CLI pre-1.x.

Maybe there's a couple of modern Rollup plugins that make this a non-issue. But we could also try to make Rollup bail out if it doesn't understand an import. A rollup plugin that'd say something like "If Rollup doesn't understand this import, just leave it as is". Then when we hand off the rollup output to webpack, webpack will try to figure it out and succeed, since it was working anyway without --experimentalRollupPass.

naveedahmed1 commented 4 years ago

For chartjs, since we are using it on just two pages, I add it dynamically from cdn in those components:

      var imported = document.createElement('script');
      imported.async = true;
      imported.src = 'https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.3.0/Chart.bundle.min.js';
      document.body.appendChild(imported);
wambowams commented 4 years ago

With 9.0.0-rc.1 and the following config:

            "production": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "extractLicenses": true,
              "vendorChunk": false,
              "commonChunk": false,
              "buildOptimizer": true,
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "1mb",
                  "maximumError": "2mb"
                },
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "6kb"
                }
              ],
              "serviceWorker": true,
              "ngswConfigPath": "ngsw-config.json"
            }
          }

I get following error using ts path aliases:

ERROR in ./src/main.ts
Module build failed (from ./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/webpack-rollup-loader.js):
Error: Can't resolve '@app-environment' in 'C:\Users\project\src'
    at doResolve (C:\Users\project\node_modules\enhanced-resolve\lib\Resolver.js:209:21)
    at hook.callAsync (C:\Users\project\node_modules\enhanced-resolve\lib\Resolver.js:285:5)
    at _fn0 (eval at create (C:\Users\project\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:15:1)
    at resolver.doResolve (C:\Users\project\node_modules\enhanced-resolve\lib\UnsafeCachePlugin.js:44:7)
    at hook.callAsync (C:\Users\project\node_modules\enhanced-resolve\lib\Resolver.js:285:5)
    at _fn0 (eval at create (C:\Users\project\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:15:1)
    at hook.callAsync (C:\Users\project\node_modules\enhanced-resolve\lib\Resolver.js:285:5)
    at _fn0 (eval at create (C:\Users\project\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:27:1)
    at resolver.doResolve (C:\Users\project\node_modules\enhanced-resolve\lib\DescriptionFilePlugin.js:67:43)
    at hook.callAsync (C:\Users\project\node_modules\enhanced-resolve\lib\Resolver.js:285:5)
    at _fn6 (eval at create (C:\Users\project\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:28:1)
    at resolver.doResolve (C:\Users\project\node_modules\enhanced-resolve\lib\ModuleKindPlugin.js:30:40)
    at hook.callAsync (C:\Users\project\node_modules\enhanced-resolve\lib\Resolver.js:285:5)
    at _fn0 (eval at create (C:\Users\project\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:15:1)
    at hook.callAsync (C:\Users\project\node_modules\enhanced-resolve\lib\Resolver.js:285:5)
    at _fn1 (eval at create (C:\Users\project\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:16:1)
 @ multi ./src/main.ts main[0]

Using a relative path for environment I get following error:

ERROR in ./src/main.ts
Module build failed (from ./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/webpack-rollup-loader.js):
Error: 'parse' is not exported by node_modules\url\url.js
    at error (C:\Users\project\node_modules\rollup\dist\rollup.js:5330:30)
    at Module.error (C:\Users\project\node_modules\rollup\dist\rollup.js:9606:9)
    at handleMissingExport (C:\Users\project\node_modules\rollup\dist\rollup.js:9525:21)
    at Module.traceVariable (C:\Users\project\node_modules\rollup\dist\rollup.js:9919:17)
    at ModuleScope.findVariable (C:\Users\project\node_modules\rollup\dist\rollup.js:8585:39)
    at FunctionScope.findVariable (C:\Users\project\node_modules\rollup\dist\rollup.js:3044:38)
    at ChildScope.findVariable (C:\Users\project\node_modules\rollup\dist\rollup.js:3044:38)
    at FunctionScope.findVariable (C:\Users\project\node_modules\rollup\dist\rollup.js:3044:38)
    at ChildScope.findVariable (C:\Users\project\node_modules\rollup\dist\rollup.js:3044:38)
    at Identifier$1.bind (C:\Users\project\node_modules\rollup\dist\rollup.js:4380:40)
    at CallExpression$1.bind (C:\Users\project\node_modules\rollup\dist\rollup.js:3131:23)
    at CallExpression$1.bind (C:\Users\project\node_modules\rollup\dist\rollup.js:6284:15)
    at VariableDeclarator.bind (C:\Users\project\node_modules\rollup\dist\rollup.js:3131:23)
    at VariableDeclaration$1.bind (C:\Users\project\node_modules\rollup\dist\rollup.js:3127:31)
    at BlockStatement$1.bind (C:\Users\project\node_modules\rollup\dist\rollup.js:3127:31)
    at FunctionExpression$1.bind (C:\Users\project\node_modules\rollup\dist\rollup.js:3131:23)
 @ multi ./src/main.ts main[0]
intellix commented 4 years ago

Was really curious how it looks on our project running NG8. I'm guessing this only works on NG9 as I could only get the flag via installing cli@next which only supports 9 as well.

If I try to use a globally installed rollup on my exported main es5/es2015 bundle then the size doesn't change at all

Splaktar commented 4 years ago

Yep, this feature is only in v9.0.0-next.9 or greater.

kirill-chirkov-at-clouty commented 4 years ago

This feature gives me next error:

ERROR in ./src/main.ts
Module build failed (from ./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/webpack-rollup-loader.js):
Error: Unexpected token (Note that you need rollup-plugin-json to import JSON files)
    at error (D:\Projects\frontend\node_modules\rollup\dist\rollup.js:5330:30)
    at Module.error (D:\Projects\frontend\node_modules\rollup\dist\rollup.js:9606:9)
    at tryParse (D:\Projects\frontend\node_modules\rollup\dist\rollup.js:9517:16)
    at Module.setSource (D:\Projects\frontend\node_modules\rollup\dist\rollup.js:9835:33)
    at D:\Projects\frontend\node_modules\rollup\dist\rollup.js:12615:20
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async Promise.all (index 0)
 @ multi ./src/main.ts main[0]

I heavily depend on importing bunch of jsons in my application for lazy-loading i18n objects. I guess this is the source of the problem, though error stack is ambiguent of an actual error line.

HitkoDev commented 4 years ago

With "resolveJsonModule": true in tsconfig and import data from 'file.json' I get

Module build failed (from @angular-devkit/build-angular/src/angular-cli-files/plugins/webpack-rollup-loader.js):    
Error: Unexpected token (Note that you need @rollup/plugin-json to import JSON files)
literalpie commented 4 years ago

Like others, I'm seeing errors "X is not exported by Y". I'm curious if there are any plans to do the rollup workarounds mentioned by Filipe, or if that was just a casual "what if..."?

elliotleelewis commented 4 years ago

Hmm, I actually get errors when using the official @angular/fire package too:

ERROR in ./src/main.ts
Module build failed (from ./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/webpack-rollup-loader.js):
Error: 'apps' is not exported by node_modules/firebase/app/dist/index.cjs.js, imported by node_modules/@angular/fire/__ivy_ngcc__/fesm2015/angular-fire.js
naveedahmed1 commented 4 years ago

I gave it another try with Angular 10.0.0-next.6 and Angular CLI 10.0.0-next.4 and now receiving this error:

D:\MyProject>ng build --prod
69% building 1355/1356 modules 1 active ...s\webpack\src\index.js!D:\MyProject\src\main.tsThe 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten
The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten
The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten
The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten
Circular dependency: node_modules\d3-selection\src\selection\index.js -> node_modules\d3-selection\src\selection\select.js -> node_modules\d3-selection\src\selection\index.js
Circular dependency: node_modules\d3-selection\src\selection\index.js -> node_modules\d3-selection\src\selection\selectAll.js -> node_modules\d3-selection\src\selection\index.js
Circular dependency: node_modules\d3-selection\src\selection\index.js -> node_modules\d3-selection\src\selection\filter.js -> node_modules\d3-selection\src\selection\index.js
Circular dependency: node_modules\d3-selection\src\selection\index.js -> node_modules\d3-selection\src\selection\data.js -> node_modules\d3-selection\src\selection\index.js
Circular dependency: node_modules\d3-selection\src\selection\index.js -> node_modules\d3-selection\src\selection\data.js -> node_modules\d3-selection\src\selection\enter.js -> node_modules\d3-selection\src\selection\index.js
Circular dependency: node_modules\d3-selection\src\selection\index.js -> node_modules\d3-selection\src\selection\exit.js -> node_modules\d3-selection\src\selection\index.js
Circular dependency: node_modules\d3-selection\src\selection\index.js -> node_modules\d3-selection\src\selection\merge.js -> node_modules\d3-selection\src\selection\index.js
Circular dependency: node_modules\d3-selection\src\selection\index.js -> node_modules\d3-selection\src\selection\sort.js -> node_modules\d3-selection\src\selection\index.js
Circular dependency: node_modules\d3-interpolate\src\value.js -> node_modules\d3-interpolate\src\array.js -> node_modules\d3-interpolate\src\value.js
Circular dependency: node_modules\d3-interpolate\src\value.js -> node_modules\d3-interpolate\src\object.js -> node_modules\d3-interpolate\src\value.js
Circular dependency: node_modules\d3-transition\src\transition\index.js -> node_modules\d3-transition\src\transition\filter.js -> node_modules\d3-transition\src\transition\index.js
Circular dependency: node_modules\d3-transition\src\transition\index.js -> node_modules\d3-transition\src\transition\merge.js -> node_modules\d3-transition\src\transition\index.js
Circular dependency: node_modules\d3-transition\src\transition\index.js -> node_modules\d3-transition\src\transition\select.js -> node_modules\d3-transition\src\transition\index.js
Circular dependency: node_modules\d3-transition\src\transition\index.js -> node_modules\d3-transition\src\transition\selectAll.js -> node_modules\d3-transition\src\transition\index.js
Circular dependency: node_modules\d3-transition\src\transition\index.js -> node_modules\d3-transition\src\transition\transition.js -> node_modules\d3-transition\src\transition\index.js

ERROR in ./src/main.ts
Module build failed (from ./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/webpack-rollup-loader.js):
Error: 'apps' is not exported by node_modules\firebase\app\dist\index.cjs.js, imported by node_modules\@angular\fire\__ivy_ngcc__\fesm2015\angular-fire.js
    at error (D:\MyProject\node_modules\@angular-devkit\build-angular\node_modules\rollup\dist\shared\rollup.js:10120:30)
    at Module.error (D:\MyProject\node_modules\@angular-devkit\build-angular\node_modules\rollup\dist\shared\rollup.js:14557:16)
    at handleMissingExport (D:\MyProject\node_modules\@angular-devkit\build-angular\node_modules\rollup\dist\shared\rollup.js:14458:28)
    at Module.traceVariable (D:\MyProject\node_modules\@angular-devkit\build-angular\node_modules\rollup\dist\shared\rollup.js:14922:24)
    at ModuleScope.findVariable (D:\MyProject\node_modules\@angular-devkit\build-angular\node_modules\rollup\dist\shared\rollup.js:13502:39)
    at FunctionScope.findVariable (D:\MyProject\node_modules\@angular-devkit\build-angular\node_modules\rollup\dist\shared\rollup.js:8664:38)
    at ChildScope.findVariable (D:\MyProject\node_modules\@angular-devkit\build-angular\node_modules\rollup\dist\shared\rollup.js:8664:38)
    at MemberExpression.bind (D:\MyProject\node_modules\@angular-devkit\build-angular\node_modules\rollup\dist\shared\rollup.js:11252:49)
    at CallExpression$1.bind (D:\MyProject\node_modules\@angular-devkit\build-angular\node_modules\rollup\dist\shared\rollup.js:8749:23)
    at CallExpression$1.bind (D:\MyProject\node_modules\@angular-devkit\build-angular\node_modules\rollup\dist\shared\rollup.js:11440:15)
    at MemberExpression.bind (D:\MyProject\node_modules\@angular-devkit\build-angular\node_modules\rollup\dist\shared\rollup.js:8749:23)
    at MemberExpression.bind (D:\MyProject\node_modules\@angular-devkit\build-angular\node_modules\rollup\dist\shared\rollup.js:11270:19)
    at VariableDeclarator.bind (D:\MyProject\node_modules\@angular-devkit\build-angular\node_modules\rollup\dist\shared\rollup.js:8749:23)
    at VariableDeclaration.bind (D:\MyProject\node_modules\@angular-devkit\build-angular\node_modules\rollup\dist\shared\rollup.js:8745:31)
    at BlockStatement$1.bind (D:\MyProject\node_modules\@angular-devkit\build-angular\node_modules\rollup\dist\shared\rollup.js:8745:31)
    at FunctionDeclaration.bind (D:\MyProject\node_modules\@angular-devkit\build-angular\node_modules\rollup\dist\shared\rollup.js:8749:23)
 @ multi ./src/main.ts main[0]
OysteinAmundsen commented 3 years ago

Tried building using @nrwl/nx and angular-cli 11:

Error: ./apps/myApp/src/main.ts
Module build failed (from ./node_modules/@angular-devkit/build-angular/src/webpack/plugins/webpack-rollup-loader.js):
Error: Can't resolve '@myProject/shared' in 'D:\dev\myProject\apps\energy\src\app'
    at D:\dev\myProject\node_modules\enhanced-resolve\lib\Resolver.js:209:21
    at D:\dev\myProject\node_modules\enhanced-resolve\lib\Resolver.js:285:5
    at eval (eval at create (D:\dev\myProject\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:13:1)
    at D:\dev\myProject\node_modules\enhanced-resolve\lib\UnsafeCachePlugin.js:44:7
    at D:\dev\myProject\node_modules\enhanced-resolve\lib\Resolver.js:285:5
    at eval (eval at create (D:\dev\myProject\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:13:1)
    at D:\dev\myProject\node_modules\enhanced-resolve\lib\Resolver.js:285:5
    at eval (eval at create (D:\dev\myProject\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:25:1)
    at D:\dev\myProject\node_modules\enhanced-resolve\lib\DescriptionFilePlugin.js:67:43
    at D:\dev\myProject\node_modules\enhanced-resolve\lib\Resolver.js:285:5
    at eval (eval at create (D:\dev\myProject\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:41:1)
    at D:\dev\myProject\node_modules\enhanced-resolve\lib\ModuleKindPlugin.js:30:40
    at D:\dev\myProject\node_modules\enhanced-resolve\lib\Resolver.js:285:5
    at eval (eval at create (D:\dev\myProject\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:13:1)
    at D:\dev\myProject\node_modules\enhanced-resolve\lib\Resolver.js:285:5
    at eval (eval at create (D:\dev\myProject\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:14:1)
 @ multi ./apps/myApp/src/main.ts main[0]

@myProject/shared is a local library and is entered as compilerOptions.paths, but the --experimentalRollupPass seems to ignore this.

angular-automatic-lock-bot[bot] commented 3 years ago

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.