Reputation: 2413
I a npm module 'sampleApp' which depends on my another npm module called 'mycommon'.
I createa a tar ball for "mycommon" module using npm pack command and installed it in "sampleApp" using "npm install ../../mycommon-1.0.0.tar.gz". Verified that node_modules for samlpleApp now contains the mycommon folder and its subdirectories correctly.
Now when i launch the sampleApp, "mycommon/mycomponent/comp.js" fails to load. My other angular2 imports are being loaded from "node_modules" correctly however locally installed dependency "mycommon" is not being loaded from node_modules. Browser network log shows that its trying to load it from file-cache.
Appreciate any pointers.
Thanks Prasad
Upvotes: 1
Views: 990
Reputation: 2413
The problem was, .ts files were compiled into a separate outDir=dist. When i bundled the module using npm pack it was bundling the dist folder and the contents / directories at my module root.
SO i put a components.js / components.d.ts file in the module root directory re-exporting the APIs in dist folder. So consuming application would import the APIs form exported file "mycommand/components".
Upvotes: 1