-
Notifications
You must be signed in to change notification settings - Fork 408
Exported typings are not a module #297
Comments
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. |
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... |
@Nek- This works for now. 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
}
declare module 'zone.js/dist/long-stack-trace-zone' {
export var Zone; // 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';
|
@park9140 using your code generate a different error:
But still an error. |
@Nek- One thing I forgot to mention that may cause a problem. The first part 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
}
declare module 'zone.js/dist/long-stack-trace-zone' {
export var Zone; // this doesn't actually do anything just makes the compiler not complain about the empty module
} I have a in a separate In addition I don't every import 'zone.js' directly anymore. |
My bad ! I added a |
@park9140 well, I still get an error related to Anyway here is the message:
|
@Nek- Getting exactly the same error, also for other modules! |
@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. |
@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 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 |
|
Hello, which version fixes this issue ? I removed the typings file in zone.js and installed typings with |
- this is temporary fix => see angular/zone.js#297
…und] - Temporary disabled zone.js typings (angular/zone.js#297)
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.
The text was updated successfully, but these errors were encountered: