1

I've got a FooComponent that has a .scss file attached to it, this works.

However, when trying to import a variable file from an external lib residing in node_modules, it throws an error.

In my .scss file I do:

@import './node_modules/@my-lib/dist/utils/_exports';

But when I run ngc -w tsconfig-aot.json it throws:

Couldn't resolve resource ./node_modules/@my-lib/dist/utils/_exports from /Users/chrillewoodz/my-project/@my-lib/ng/src/components/foo/foo.component.scss

The strange thing is that if I do ngc -p tsconfig-aot.json (notice the -p instead of -w) then it works.

Why is this happening?

3
  • If you are inside the component, ./node_modules will look inside the component folder, no ? Commented Feb 5, 2018 at 10:10
  • @David I don't think so since using -p works correctly. I have tried many other paths as well but none of them work. So I don't think the problem is with the path itself :/ Commented Feb 5, 2018 at 10:12
  • try using ~ instead of ./node_modules/ like this '~@my-lib/dist/utils/_exports' Commented Feb 5, 2018 at 10:15

1 Answer 1

0

Turns out it was as simple as having to use both -w and -p, the -p is for explicitly telling ngc which config to use. So without it it was using the default tsconfig.json file.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.