After upgrading to RC0 last night, I noticed that building my project for devices wasn’t working as expected. To try and see if I missed something, I created a blank new project with the latest ionic cli. If I’m trying to build that clean project, I receive this same error message:
Error: Could not resolve entry (.tmp/app/main.prod.js)
at /Users/henkiepenkie/Development/testproject/test/node_modules/@ionic/app-scripts/node_modules/rollup/dist/rollup.js:8602:28
I’m running on npm version 3.10.3, node 6.7.0 and ionic 2.1.0 (OSX).
If I try to run ionic serve on the brand new project, it failed with the same kind of error. After deleting the node_modules and reinstalling them, everything seemed to work fine for a brand new project. Ionic serve just works fine on my own project, but when I try to build my android project, it fails on the typings.
My question is, how can I put back my custom typings with typescript 2.0?
Okay, for anyone else encountering the same kind of issue and wondering how to fix this:
typescript 2.0 looks into the @types folder inside the node_modules. More information in this stackoverflow post. I moved my previously made custom typings in to the node_modules/@types folder and everything works as expected now. No more need to use tsconfig and such stuff!
I am struggling with this as well. Haven’t gotten it to work yet. Can you be more specific about what “I moved my previously made custom typings in to the node_modules/@types folder” means?
I previously created my typings following the suggestion in this thread, by adding types explicitly to the main.d.ts file in the typings folder. My file (in Ionic 2 beta) looks like this:
There is also a globals folder with the referenced es6-shim in the same typings folder.
However, in the new RC0 template, first of all the @types folder doesn’t exist in my node_modules folder – and just moving all the files from my “typings” folder into a “@types” folder that I created myself doesn’t seem to work.
I think it is always a mistake to manually modify things under node_modules. It seems like a good idea, but npm will blow away your changes very frequently and without warning. If you have to have local versions of things that aren’t in npm repos, use the npm link command instead.
The perfect scenario would be that your custom made typing is under the npm registry, as @rapropos said (for obvious reasons). That being said, if you would like to maintain a local version of your typings, check out the NPM link docs over here.. It will explain how to create such a global link inside the node_modules folder.
When migrating to RC.0 I just moved my custom types definition files (myfile.d.ts)under the “src/providers” folder (actually I even created a subfolder “types” in it) and that worked just like that.
I rather liked to see these definition files under src than under node_modules, even it’s maybe not the cutest solution
Its better to it this way then just putting in the node_modules folder. If you want to be really redundant you can make an npm link to node_modules/@typings . Then you can keep your own definitions wherever you like, and still remain the @types structure without losing the typings when node_modules updates :-).
Thank you. I also managed with your solution, but I first created a customTypings folder under the src one, and put the customTypings there. One must not forget to install the typings locally typings install --save file:src/customTypings/myTypings.d.ts.
I thought about publishing in DefinitelyTyped but
Typings are not mine, I imported it from the ng2-chess github project
Also I could not install all npm dependencies for the definitelyTypings repository once cloned on my HDD.