You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to import the module built by the "gulp build" command but it fails.
My Typescript version is 1.8.10.
This is what I have done :
Create the module : mkdir my-new-project \ && cd $_ \ && yo node-typescript \ && gulp build \ && cd ..
Create the project that will use the module : mkdir my-requiring-project \ && cd $_ \ && mkdir node_modules \ && cp -r ../my-new-project ./node_modules \ && echo "import MyNewProject = require('my-new-project')" >> index.ts
Compile the project : tsc index.ts
This is the error : index.ts(1,31): error TS2656: Exported external package typings file '~/dev/nodejs/projects/my-requiring-project/node_modules/my-new-project/lib/my-new-project.d.ts' is not a module. Please contact the package author to update the package definition.
Could you help me to find a way to import the created module into a new project? Any help would be greatly appreciated.
The text was updated successfully, but these errors were encountered:
It seems to be caused by empty declaration file emitted by the TypeScript compiler when nothing is exported from the source files. I could find a couple of TypeScript issues related to this - microsoft/TypeScript#6022 and microsoft/TypeScript#8124. You might want to check and try out some suggestions by other users on those issues.
Hello,
I am trying to import the module built by the "gulp build" command but it fails.
My Typescript version is 1.8.10.
This is what I have done :
mkdir my-new-project \
&& cd $_ \
&& yo node-typescript \
&& gulp build \
&& cd ..
mkdir my-requiring-project \
&& cd $_ \
&& mkdir node_modules \
&& cp -r ../my-new-project ./node_modules \
&& echo "import MyNewProject = require('my-new-project')" >> index.ts
tsc index.ts
This is the error :
index.ts(1,31): error TS2656: Exported external package typings file '~/dev/nodejs/projects/my-requiring-project/node_modules/my-new-project/lib/my-new-project.d.ts' is not a module. Please contact the package author to update the package definition.
Could you help me to find a way to import the created module into a new project? Any help would be greatly appreciated.
The text was updated successfully, but these errors were encountered: