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

Angular 12.1 some Inline styles will fail in the test command #21236

Closed
1 of 15 tasks
hsuanxyz opened this issue Jun 29, 2021 · 1 comment · Fixed by #21238
Closed
1 of 15 tasks

Angular 12.1 some Inline styles will fail in the test command #21236

hsuanxyz opened this issue Jun 29, 2021 · 1 comment · Fixed by #21238
Assignees
Labels
area: @ngtools/webpack freq1: low Only reported by a handful of users who observe it rarely severity5: regression type: bug/fix
Milestone

Comments

@hsuanxyz
Copy link
Contributor

🐞 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, the previous version in which this bug was not present was: 12.0.3

Description

Running a test will throw an error when the inline style is:

import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styles: [`
      .content {
        display: flex;
      }
      .extra > a { }
    `]
})
export class AppComponent { }

🔬 Minimal Reproduction

https://github.com/hsuanxyz/ng-12-1-inline-styles-issue

$ git clone [email protected]:hsuanxyz/ng-12-1-inline-styles-issue.git
$ cd ng-12-1-inline-styles-issue
$ npm i
$ npm run test

🔥 Exception or Error



./src/app/app.component.ts.less!=!./node_modules/@ngtools/webpack/src/inline-data-loader.js?data=CiAgICAgIC5jb250ZW50IHsKICAgICAgICBkaXNwbGF5OiBmbGV4OwogICAgICB9CiAgICAgIC5leHRyYSA+IGEgeyB9CiAgICA=!./src/app/app.component.ts - Error: Module build failed (from ./node_modules/less-loader/dist/cjs.js):


      }
      .extraH�B�
           ^
Unrecognised input
      Error in .../inner-styles/src/app/app.component.ts (line 5, column 13)


🌍 Your Environment



Angular CLI: 12.1.0
Node: 12.16.1
Package Manager: npm 6.13.4
OS: darwin x64

Angular: 12.1.0
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1201.0
@angular-devkit/build-angular   12.1.0
@angular-devkit/core            12.1.0
@angular-devkit/schematics      12.1.0
@schematics/angular             12.1.0
rxjs                            6.6.7
typescript                      4.3.4

Anything else relevant?

This is a minimal recurrence, with a few changes to the content errors will not appear. For examples:

 [`
-      .content {
+      .content1 {
        display: flex;
      }
      .extra > a { }
 `]
 [`
      .content {
-        display: flex;
+        display: block;
      }
      .extra > a { }
 `]
 [`
+.   .foo { }
      .content {
        display: flex;
      }
      .extra > a { }
 `]
 [`
      .content {
        display: flex;
      }
+ 
      .extra > a { }
 `]
@alan-agius4 alan-agius4 added freq1: low Only reported by a handful of users who observe it rarely severity5: regression area: @ngtools/webpack labels Jun 29, 2021
@ngbot ngbot bot added this to the needsTriage milestone Jun 29, 2021
@ngbot ngbot bot modified the milestones: needsTriage, Backlog Jun 29, 2021
@alan-agius4 alan-agius4 self-assigned this Jun 30, 2021
alan-agius4 added a commit that referenced this issue Jun 30, 2021
We now encode the data using `encodeURIComponent` which safely encodes `+` signs. Without this a portion of the buffer was lost and caused `Unrecognised input` errors.

Closes #21236
alan-agius4 added a commit that referenced this issue Jun 30, 2021
We now encode the data using `encodeURIComponent` which safely encodes `+` signs. Without this a portion of the buffer was lost and caused `Unrecognised input` errors.

Closes #21236

(cherry picked from commit 6a7bcf3)
@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 Jul 31, 2021
ikjelle pushed a commit to ikjelle/angular-cli that referenced this issue Mar 26, 2024
We now encode the data using `encodeURIComponent` which safely encodes `+` signs. Without this a portion of the buffer was lost and caused `Unrecognised input` errors.

Closes angular#21236
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: @ngtools/webpack freq1: low Only reported by a handful of users who observe it rarely severity5: regression type: bug/fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants