Angular-cli: Relative paths for assets in sass (scss) files doesn't work after migrating to rc1

Created on 9 Mar 2017  路  4Comments  路  Source: angular/angular-cli

OS?

Mac OSX (Yosemite)

Versions.

@angular/cli: 1.0.0-rc.1
node: 7.2.0
os: darwin x64
@angular/common: 2.4.9
@angular/compiler: 2.4.9
@angular/core: 2.4.9
@angular/forms: 2.4.9
@angular/http: 2.4.9
@angular/platform-browser: 2.4.9
@angular/platform-browser-dynamic: 2.4.9
@angular/router: 3.4.9
@angular/cli: 1.0.0-rc.1
@angular/compiler-cli: 2.4.9

Repro steps.

After updating from "1.0.0-beta.30" to "1.0.0-rc.1" relative paths in sass files doesn't work.
For example, before migration this worked good:
background: url('./assets/some-icon.png')

After migrating I must provide a full path like this:
background: url('../../../../assets/some-icon.png')

The log given by the failure.

ERROR in ./src/app/folder/components/some-component/some.component.scss
Module not found: Error: Can't resolve './assets/some-icon.png' in '/Users/some-user/.../app/src/app/folder/components/some-component'
@ ./src/app/folder/components/some-component/some.component.scss 6:1065-1107
@ ./src/app/folder/components/some-component/some.component.ts
@ ./src/app/folder/folder.module.ts
@ ./src async
@ ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js
@ ./~/@angular/core/src/linker.js
@ ./~/@angular/core/src/core.js
@ ./~/@angular/core/index.js
@ ./src/main.ts
@ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts
webpack: Failed to compile.

Most helpful comment

All 4 comments

Same here, in the end, dist folder gets a lot of files

Dupe of https://github.com/angular/angular-cli/issues/4778, see there for answers.

FYI a relative path does mean it's relative from where you are. ../../../../assets/some-icon.png is a relative path.

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._

Was this page helpful?
0 / 5 - 0 ratings