Skip to content
This repository was archived by the owner on Sep 9, 2024. It is now read-only.
This repository was archived by the owner on Sep 9, 2024. It is now read-only.

Breaks on Angular applications #7

@filipesilva

Description

@filipesilva

Hi there,

I was trying out this plugin in an Angular app and it seems it breaks some of the imports there.

I'm not sure what's going wrong but tried to prepare the simplest repro possible:

git clone https://github.com/filipesilva/angular-deep-scope
cd angular-deep-scope
npm install
npm run ngc
npm serve

Note: the npm run ngc compiles the typescript files in AOT mode for Angular. You only need to run this once really.

After serving you can go to http://localhost:8080/ and you should see an error. If you remove the new WebpackDeepScopeAnalysisPlugin(), line from webpack.config.js (and restart the server) the error goes away and you should see a Hello World message.

The error is:

app.component.ngfactory.js:10 Uncaught TypeError: undefined is not a function
    at Module.<anonymous> (app.component.ngfactory.js:10)
    at __webpack_require__ (bootstrap:724)
    at fn (bootstrap:101)
    at Object.window.__webpackHotClient__ (main.js:21153)
    at __webpack_require__ (bootstrap:724)
    at bootstrap:791
    at bootstrap:791

It seems to be in this line:

// src/app.component.ngfactory.js
var RenderType_AppComponent = i0.ɵcrt({ encapsulation: 2, styles: styles_AppComponent, data: {} });

When WebpackDeepScopeAnalysisPlugin is present, this line is transformed into:

var RenderType_AppComponent = /* unused reexport */undefined({ encapsulation: 2, styles: styles_AppComponent, data: {} });

Since i0.ɵcrt() is transformed into undefined() the app fails at runtime.

I'm not sure why that transformation happens but if I can help further let me know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions