Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@ngtools crashes when using scss with ViewEncapsulation.None #2584

Closed
qdouble opened this issue Oct 8, 2016 · 8 comments · Fixed by #3256
Closed

@ngtools crashes when using scss with ViewEncapsulation.None #2584

qdouble opened this issue Oct 8, 2016 · 8 comments · Fixed by #3256
Assignees
Labels
P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful type: bug/fix

Comments

@qdouble
Copy link

qdouble commented Oct 8, 2016

Please provide us with the following information:

OS?

Mac OSX (Sierra)

Versions.

Using webpack repo from the test directory: https://github.com/angular/angular-cli/tree/master/tests/e2e/assets/webpack/test-app

Repro steps.

If you set ViewEncapsulation.None any component, like right here: https://github.com/qdouble/show-encapsulation-error/blob/master/app/app.component.ts#L9 and then run the webpack command it will crash. You can download the repo from that link if you want, the only thing that I changed is adding ViewEncapsulation.None

The log given by the failure.

ERROR in ./app/ngfactory/app/app.component.ngfactory.ts                             
Module build failed: Error: /Users/qdouble/Sites/EXAMPLE_APPS/show-encapsulation-err
or/app/ngfactory/app/app.component.ngfactory.ts (17,27): Cannot find module '../../a
pp.component.scss'.)                                                                
    at _transpile (/Users/qdouble/Sites/EXAMPLE_APPS/show-encapsulation-error/node_m
odules/@ngtools/webpack/src/loader.js:101:19)                                       
    at /Users/qdouble/Sites/EXAMPLE_APPS/show-encapsulation-error/node_modules/@ngto
ols/webpack/src/loader.js:125:26                                                    
 @ ./app/ngfactory/app/app.module.ngfactory.ts 34:0-54                              
 @ ./app/main.aot.ts                                                                

ERROR in ./app/ngfactory/app/lazy.module.ngfactory.ts                               
Module build failed: Error: /Users/qdouble/Sites/EXAMPLE_APPS/show-encapsulation-err
or/app/ngfactory/app/app.component.ngfactory.ts (17,27): Cannot find module '../../a
pp.component.scss'.)                                                                
    at _transpile (/Users/qdouble/Sites/EXAMPLE_APPS/show-encapsulation-error/node_m
odules/@ngtools/webpack/src/loader.js:101:19)                                       
    at /Users/qdouble/Sites/EXAMPLE_APPS/show-encapsulation-error/node_modules/@ngto
ols/webpack/src/loader.js:125:26                                                    
 @ ./app/ngfactory async                                                            
 @ ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js               
 @ ./app/ngfactory/app/app.module.ngfactory.ts                                      
 @ ./app/main.aot.ts 
@filipesilva filipesilva added type: bug/fix command: build P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful labels Oct 10, 2016
@DzmitryShylovich
Copy link

Might be related to angular/angular#11408

@montella1507
Copy link

I hope this will be fixed soon.

@montella1507
Copy link

Is someone still working on that problem?

@kuldeepkeshwar
Copy link

any workaround for this ?

@debben
Copy link

debben commented Nov 12, 2016

For places where ViewEncapsulation.None was used, I've removed the styles altogether and just placed a line import 'styles!./path/to/style.scss' above the component. When using just-in-time compilation, Angular was pretty much just doing the same thing as the style loader I think and injecting a new style tag with the contents in the head section.

This bug has also had me reevaluating the styles I was using in components with ViewEncapsulation.None to determine what can be promoted to just a global stylesheet and what should stay. The styles that are component specific I'm working to change to use ViewEncapsulation.Emulated.

@hansl
Copy link
Contributor

hansl commented Nov 22, 2016

@DzmitryShylovich Yes it's related to that issue in the code generator.

In the CLI itself I'm going to move the generated code to its own directory. A PR should come soon to do just this. That way we will avoid the issue. There will not be a change in the configuration so you guys should not notice anything different (other than the bug being fixed).

@hansl
Copy link
Contributor

hansl commented Nov 23, 2016

Actually I retract my previous statement. This does not seem related to that issue, but rather might be a bug in the ngtools itself when using outside of the CLI, and using genDir that's not the basePath. I'm trying to repro locally and investigating further.

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful type: bug/fix
Projects
None yet
7 participants