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
{{ message }}
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
Exported external package typings file '**/node_modules/zone.js/dist/zone.js.d.ts' is not a module. Please contact the package author to update the package definition.
It appears that the typescript build is not outputting a module in it's definitions output.
This appears to be because the core file being built is not built as an external module. You need to have at least one import or export to create the external module.
declare module 'zone.js/dist/zone'{exportvarZone;// this doesn't actually do anything just makes the compiler not complain about the empty module}declare module 'zone.js/dist/long-stack-trace-zone'{exportvarZone;// this doesn't actually do anything just makes the compiler not complain about the empty module}import'zone.js/dist/zone';import'zone.js/dist/long-stack-trace-zone';
long-stack-trace-zone is necessary because I am using angular 2.
@park9140 using your code generate a different error:
src-js/app/main.ts(4,16): error TS2664: Invalid module name in augmentation, module 'zone.js/dist/zone' cannot be found.
src-js/app/main.ts(7,16): error TS2664: Invalid module name in augmentation, module 'zone.js/dist/long-stack-trace-zone' cannot be found.
@Nek- One thing I forgot to mention that may cause a problem.
The first part
declare module 'zone.js/dist/zone'{exportvarZone;// this doesn't actually do anything just makes the compiler not complain about the empty module}declare module 'zone.js/dist/long-stack-trace-zone'{exportvarZone;// this doesn't actually do anything just makes the compiler not complain about the empty module}
I have a in a separate .d.ts ambient definition. I'm not sure if those declares have to be in a .d.ts file. Also I'm using typescript 1.8.9.
In addition I don't every import 'zone.js' directly anymore.
@Nek- Getting exactly the same error, also for other modules!
Is main.ts the file where you import the zone.js stuff? Why do we need a d.ts now if it is already TS ?
@robwormald discussed this with @mhevery this week, the reasoning for this is that zones are considered a polyfill, so you're expected to treat zone.js as an ambient dependency. Include zone.js.d.ts as an input to the typescript compilation, or use a ///<reference path=""/> to bring it into the compiler.
Importing from it is not the suggested pattern, as that produces a value-side expression in the JS emit asking the module loader to load zone, and instead it should be included as a browser polyfill before the module loader starts.
It's also tricky to get the right order - if you load zone.js after the module loader has started up, then the module loader or any previously loaded modules may hold a reference to un-patched async primitives, which will not be zone-aware.
Closing as WAI, but please let me know if there's something we could do better here. Maybe import * as zone from 'zone.js'; should bring some symbols into scope?
declare module 'zone.js/dist/zone' { export var Zone; // this doesn't actually do anything just makes the compiler not complain about the empty module }
doesn't work , getting . Invalid module name in augmentation, module 'zone.js/dist/zone' cannot be found, though i vave zone.js module inside node_modeles
Hello, which version fixes this issue ? I removed the typings file in zone.js and installed typings with typings install dt~zone.js --save --global and it solves the issue, but there should be a way without workaround.
Reacted by Ivan Yaroslavtsev, houfeng, Lekhnath Rijal, Paul Meskers, Chris Frolik, Rudinei Goi Roecker, Hiromu OCHIAI and Gustavo Henke
Activity
[-]Exprted typings are not a module[/-][+]Exported typings are not a module[/+]park9140 commentedon Mar 23, 2016
This appears to be because the core file being built is not built as an external module. You need to have at least one import or export to create the external module.
Nek- commentedon Mar 24, 2016
I'm having same issue @park9140 did you fixed it ?
If I don't import 'zone.js' my code does not work but if I do I get this error...
park9140 commentedon Mar 24, 2016
@Nek- This works for now.
long-stack-trace-zoneis necessary because I am using angular 2.Nek- commentedon Mar 24, 2016
@park9140 using your code generate a different error:
But still an error.
park9140 commentedon Mar 24, 2016
@Nek- One thing I forgot to mention that may cause a problem.
The first part
I have a in a separate
.d.tsambient definition. I'm not sure if those declares have to be in a.d.tsfile. Also I'm using typescript 1.8.9.In addition I don't every import 'zone.js' directly anymore.
Nek- commentedon Mar 24, 2016
My bad ! I added a
main.d.ts. It works like a charm. Thank you so much.Nek- commentedon Mar 24, 2016
@park9140 well, I still get an error related to
zone.js. I don't know why. But this is not critical (the app works)Anyway here is the message:
sebilasse commentedon Apr 8, 2016
@Nek- Getting exactly the same error, also for other modules!
Is main.ts the file where you import the zone.js stuff? Why do we need a d.ts now if it is already TS ?
Nek- commentedon Apr 17, 2016
@sebilasse idk why TS is asking for a d.ts when it's already in TS :/. But yes I put the fix in my main.ts file.
alexeagle commentedon Apr 24, 2016
@robwormald discussed this with @mhevery this week, the reasoning for this is that zones are considered a polyfill, so you're expected to treat zone.js as an ambient dependency. Include
zone.js.d.tsas an input to the typescript compilation, or use a///<reference path=""/>to bring it into the compiler.Importing from it is not the suggested pattern, as that produces a value-side expression in the JS emit asking the module loader to load zone, and instead it should be included as a browser polyfill before the module loader starts.
It's also tricky to get the right order - if you load zone.js after the module loader has started up, then the module loader or any previously loaded modules may hold a reference to un-patched async primitives, which will not be zone-aware.
Closing as WAI, but please let me know if there's something we could do better here. Maybe
import * as zone from 'zone.js';should bring some symbols into scope?sap9433 commentedon Apr 25, 2016
declare module 'zone.js/dist/zone' { export var Zone; // this doesn't actually do anything just makes the compiler not complain about the empty module }doesn't work , getting .
Invalid module name in augmentation, module 'zone.js/dist/zone' cannot be found, though i vavezone.jsmodule insidenode_modelesrahmanusta commentedon Jun 13, 2016
Hello, which version fixes this issue ? I removed the typings file in zone.js and installed typings with
typings install dt~zone.js --save --globaland it solves the issue, but there should be a way without workaround.[#3] Fixed an issue with the zone.js typings import
[no-issue] Disable zone.js typings on post install [temporary-workaro…