Skip to content

css protocol relative url no longer handled in postcss-loader #12648

Closed
@mrjpeterj

Description

@mrjpeterj

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Command (mark with an x)

- [ ] new
- [x] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Versions

Angular CLI: 7.0.1
Node: 8.11.1
OS: win32 x64
Angular: 7.0.0
... animations, cdk, common, compiler, compiler-cli, core, forms
... http, language-service, material, platform-browser
... platform-browser-dynamic, router

Package Version

@angular-devkit/architect 0.10.1
@angular-devkit/build-angular 0.10.1
@angular-devkit/build-optimizer 0.10.1
@angular-devkit/build-webpack 0.10.1
@angular-devkit/core 7.0.1
@angular-devkit/schematics 7.0.1
@angular/cli 7.0.1
@angular/flex-layout 7.0.0-beta.19
@ngtools/webpack 7.0.1
@schematics/angular 7.0.1
@schematics/update 0.10.1
rxjs 6.3.3
typescript 3.1.3
webpack 4.19.1

Repro steps

Try to build a project with a css url that uses a protocol relative url

The log given by the failure

ERROR in ./src/styles.scss
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleError: Module Error (from ./node_modules/postcss-loader/lib/index.js):
(Emitted value instead of an instance of Error) CssSyntaxError: E:\src\tangentix\pdeplatform\DataDelivery\Hub\UI2\src\styles.scss:2001:26: Can't resolve '//imgcdn.gamesessions.com/gs-web-new/classic-bg.jpg' in 'E:\src\tangentix\pdeplatform\DataDelivery\Hub\UI2\src'

  1999 |
  2000 | .std-bg {
> 2001 |   background-image: url("//imgcdn.gamesessions.com/gs-web-new/classic-bg.jpg");
       |                          ^
  2002 |   background-size: inherit;
  2003 |   background-repeat: no-repeat;

    at Object.emitError (E:\src\tangentix\pdeplatform\DataDelivery\Hub\UI2\node_modules\webpack\lib\NormalModule.js:169:6)
    at Promise.all.urlDeclarations.map (E:\src\tangentix\pdeplatform\DataDelivery\Hub\UI2\node_modules\@angular-devkit\build-angular\src\angular-cli-files\plugins\postcss-cli-resources.js:131:28)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

Desired functionality

This should still work as before, since it is valid css

Mention any other details that might be useful

After updating from @angular/cli 6.2.1 and @angular-devkit/build-angular 0.7.0 the sccs fragment of

.std-bg {
    background-image: url("//imgcdn.gamesessions.com/gs-web-new/classic-bg.jpg");
}

no longer builds

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions