Skip to content

CSS imports do not work for component CSS #4285

Closed
@filipesilva

Description

@filipesilva

In beta.26, the following results in a runtime error:

// src/app/app.component.css
@import '~bootstrap/scss/bootstrap'
http://localhost:4200/~bootstrap/scss/bootstrap Failed to load resource: the server responded with a status of 404 (Not Found)
polyfills.bundle.js:6292 Unhandled Promise rejection: Failed to load ~bootstrap/scss/bootstrap ; Zone: <root> ; Task: Promise.then ; Value: Failed to load ~bootstrap/scss/bootstrap 

For global styles, css-loader is what resolves imports currently. Component styles had css-loader added in an incorrect way, which resulted in broken CSS (fixed by @clydin in #3511).

Using 'exports-loader?module.exports.toString()' together with css-loader fixes this bug, but I know @clydin is currently working in css-loader replacement functionality via PostCSS plugins for imports, which also solves the problem so it's better to wait for that solution.

Metadata

Metadata

Assignees

Labels

P1Impacts a large percentage of users; if a workaround exists it is partial or overly painful

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions