question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[v4.0.0-rc0] scss paths and ngc issues

See original GitHub issue

Type of Issue

[x] Bug Report
[ ] Feature Request

Description

I prepared a branch to show what I have issues with since v4.0.0-rc0.

Local scss paths I think we have an unintended problem with scss paths since this PR https://github.com/dherges/ng-packagr/commit/2655defd9bce751955acc41212355544195ed452

It’s not possible anymore to import local scss files without explicitly declare the local folder as a source for styles via styleIncludePaths. In the existing scss-paths sample I had to add this line https://github.com/georgiee/ng-packagr/commit/a8e41dee3749997f0517d96c826024f1ddb59ceb#diff-b869ab5af02a430f807c7463151e280aR15 in order to load the local scss file local-mixins.scss. In my real world project I have to add an even short path to some of my secondary entry points:

"styleIncludePaths": ["./"]

Is this effect intended? I appreciate the alignment with Angular CLI but I think currently it’s missing to look up the local folder of each entry point by default.

TS error I have als included a little TS snippet.

export function someOtherFoo(value: any) {
  return typeof value === 'string';
}

https://github.com/georgiee/ng-packagr/blob/d6e1ec83712a48dd643d4a3aba57ddba0577df7e/integration/samples/scss-paths/sub-module/bar/foo.ts#L1-L3

This will cause the sample to fail with this error message.

BUILD ERROR
Cannot read property 'text' of undefined
TypeError: Cannot read property 'text' of undefined
    at TokenObject.TokenOrIdentifierObject.getText (

This was working before so it might be related to some changes in the tsconfig/aot compiler. When replaced with a more simple return statement it’s working (see how to reproduce for details). So it’s related to this issue here: https://github.com/UltimateAngular/aot-loader/issues/14

How To Reproduce

I updated the scss-paths sample and included it in the launch.json so you can just easily run it. It will fail with the getText error due issues with the someOtherFoo function. Replace with this:

export function someOtherFoo(value: any) {
  return true;
}

It’s working then. Now remove the ./bar path in the package.json of the sample

//before
"styleIncludePaths": ["../assets", "./assets", "./bar"]
//after
"styleIncludePaths": ["../assets", "./assets"]

It will fail with the message:

Error: File to import not found or unreadable: ./local-mixins.scss.

Well because the folder is not part of the lookup array.

Version Information

Example is based on latest ng-packagr master. Here my ng -v

Angular CLI: 6.0.3
Node: 8.9.4
OS: darwin x64
Angular: 6.0.0
... common, compiler, compiler-cli, core, http, language-service
... platform-browser

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.6.3 (cli-only)
@angular-devkit/core         0.6.0
@angular-devkit/schematics   0.6.3 (cli-only)
@angular/cdk                 6.2.0
@angular/router              6.0.1
@ngtools/json-schema         1.1.0
@schematics/angular          0.6.3 (cli-only)
@schematics/update           0.6.3 (cli-only)
rxjs                         6.1.0
typescript                   2.7.2

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
georgieecommented, Jul 6, 2018

I just tested 4.0.0-rc3 and it works great.

  1. I pulled the test branch I provided for this issue and rebased to tag v4.0.0-rc.3 and run the scss-paths sample. Works ✅👌
  2. To make it bullet proof I swapped ng-packagr 3.x with v4.0.0-rc.3 in our UI library and added the enableResourceInlining option. It’s building and also the integration test based on the built artefacts are working ✅. Awesome work. Thank you very much!

I consider this issue closed 🙏

1reaction
georgieecommented, Jun 5, 2018

Hey @alan-agius4, thanks a lot for your response. I’m also sorry that I created only one issue for this matter- this bad idea rose from the single repository I used to showcase the problems.

I will give your linked PR a try (that linked commit looks like a proof already) and also test the incremental build functionality. This looks like a fantastic piece of work just by looking at the changes 👏

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: 'node-sass' version 5.0.0 is incompatible with ^4.0.0
When I uninstall node-sass and re-install @4.14.1, the problem persists since I am using Node version 15.3.0 which expects node-sass version 5.0 ...
Read more >
Sass: @import
The @import rule has a number of serious issues: ... To ensure that stylesheets work on every operating system, Sass imports files by...
Read more >
sass-loader - webpack - JS.ORG
The loader will first try to resolve @import as a relative path. If it cannot be resolved, then the loader will try to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found