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

Issue running extract-i18n against a component with inline styles #20750

Closed
1 of 15 tasks
terencehonles opened this issue May 13, 2021 · 2 comments
Closed
1 of 15 tasks

Comments

@terencehonles
Copy link

terencehonles commented May 13, 2021

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Yes, in v12 from v11

Description

When running extract-i18n on a component with inline styles there is a message about missing webpack loaders like the following:

You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| 
>     :host {
|       display: block;
|       height: 0;

🔬 Minimal Reproduction

  1. Create a new app ng new repro-app
  2. Edit app.component.ts
    diff --git a/src/app/app.component.ts b/src/app/app.component.ts
    index 6d0fe10..43db9cf 100644
    --- a/src/app/app.component.ts
    +++ b/src/app/app.component.ts
    @@ -3,7 +3,7 @@ import { Component } from '@angular/core';
     @Component({
       selector: 'app-root',
       templateUrl: './app.component.html',
    -  styleUrls: ['./app.component.css']
    +  styles: [':host { display: block; height: 0; }']
     })
     export class AppComponent {
       title = 'repro-app';
  3. Install npm install @angular/localize
  4. Run npm run ng extract-i18n

🔥 Exception or Error

You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| 
>     :host {
|       display: block;
|       height: 0;

🌍 Your Environment


Angular CLI: 12.0.0
Node: 14.16.1
Package Manager: npm 6.14.12
OS: linux x64

Angular: 12.0.0
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, google-maps, language-service, localize, material
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1200.0
@angular-devkit/build-angular   12.0.0
@angular-devkit/core            12.0.0
@angular-devkit/schematics      12.0.0
@schematics/angular             12.0.0
rxjs                            6.6.7
typescript                      4.2.4

@ngbot ngbot bot added this to the Backlog milestone May 13, 2021
terencehonles added a commit to terencehonles/angular-cli that referenced this issue May 13, 2021
… running extract-i18n

When extracting inline styles in Angular 12 there seems to be no CSS
loader specified and there will be something like the following message:

  angular-resource://:2:4 - Error: Module parse failed: Unexpected token (2:4)
  You may need an appropriate loader to handle this file type, currently no
  loaders are configured to process this file. See
  https://webpack.js.org/concepts#loaders
  |
  >     :host {
  |       display: block;
  |       height: 0;

This change adds a `webpack.NormalModuleReplacementPlugin` in extract-i18n for
`angular-resource://` handling them as the non inline styles are handled.

closes: angular#20750
alan-agius4 pushed a commit that referenced this issue May 14, 2021
… running extract-i18n

When extracting inline styles in Angular 12 there seems to be no CSS
loader specified and there will be something like the following message:

  angular-resource://:2:4 - Error: Module parse failed: Unexpected token (2:4)
  You may need an appropriate loader to handle this file type, currently no
  loaders are configured to process this file. See
  https://webpack.js.org/concepts#loaders
  |
  >     :host {
  |       display: block;
  |       height: 0;

This change adds a `webpack.NormalModuleReplacementPlugin` in extract-i18n for
`angular-resource://` handling them as the non inline styles are handled.

closes: #20750
@alan-agius4
Copy link
Collaborator

Closed via #20749

@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 Jun 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants