od-virtualscroll: Problem to import module
I install the od-virtualscroll using:
yarn add od-virtualscroll
But when I try to import the module on my own module doesn’t find it:
import {VirtualScrollModule} from 'od-virtualscroll';
"Cannot find module od-virtualscroll’
I have my code using angular-cli and angular4
Can anyone help me, certainly I’m doing something wrong
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 1
- Comments: 15 (6 by maintainers)
Worked for me… angular/compiler: ^4.0.1 angular/cli: 1.2.7 node: v6.11.2 npm: 3.10.10
I had a problem with ngc upgrading from 4.1 to 4.2 - in summary: the ngc’s output differed from 4.1, so the build was broken. I’m pretty sure this is related to this issue. I hope to get some spare hours to look into this again this week.
@dinony I recently came into this issue and resolve it with something very silly. It seems for the main/module/es2015/typings fields in package.json for compiler over 4.2 you need to give the full relative path e.g.
Your Package.json
becomes
I know this might seem odd but i made these changes and i was able to use FESM’s in another internal project with my library being set that way. If you want I can try it with your library or you can do it and let me know if it worked.
As an added note. The typescript team prefers “types” over “typings” but they do the same thing I believe. I just don’t know if it will be deprecated or is already.
Worked for me as well, thanks a lot.
Working here as well
Works for me (AOT, angular 4.3.5, npm 5.3.0, node 8.4.0)
Issue / Observation
I’m using the recommended angularCompilerOptions (see tsconfig.json) with the flatModuleOutFile option to create a fesm.
Quickfix
As a quick fix to this issue, I’ve published v1.0.1 of the lib with compilation relying on v4.1.3 of ngc. For the lib, the peer dependencies are set to >=4.
I’ve tried to use the lib with the latest Angular version (currently 4.3.5) and it worked. As a proof, I’ve updated od-vsstatic to Angular 4.3.5 and will also update all the other demos.
Help
Unfortunately, I could not find good documentation on ngc and for me it is currently just a beautiful time sink to find out what the actual problem is - therefore the quickfix with 4.1.3. Furthermore, there seem to be regressions in ngc >= 4.2.
In the long term, I obviously want to upgrade to the newest ngc version.
ngc
If somebody has a clue what’s going on in ngc >= 4.2 and why the output differs, I’m very thankfull for hints.
Test
I’m also very thankful if somebody tests the new release with the newest Angular version, both using npm and yarn, as extra confirmation.
Thanks!