-
Notifications
You must be signed in to change notification settings - Fork 472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to import jsonpatch - version 0.6.0 #356
Comments
Hey @slubowsky, thanks for the issue! What do you have If you have moduleResolution set correctly, you should be able to import it like this: import * as jsonpatchFormatter from 'jsondiffpatch/formatters/jsonpatch'; Let me know if that helps! |
@Methuselah96 I have it set to "node". Using current Angular 17.0.8 cli to generate a new app I see it sets it to "node" as well.
|
Yeah, sorry this is painful at the moment, but our hands are somewhat tied. ProblemWe can't support Node ESM without using package.json TypeScript requires setting The reason the build is failing when you use Ideal solutionFor these reasons, Angular users should ideally have What fails to build when you You'll want to switch to using Potential workaroundIf your hands are tied, and you can't update declare module 'jsondiffpatch/formatters/jsonpatch' {
export * from 'jsondiffpatch/lib/formatters/jsonpatch';
} That should let TypeScript know that it can import from Let me know if that helps! Again, sorry for the friction, we're caught in the middle of the JS community slowly transitioning to using ESM by default, which can cause some pain if not everything supports it. |
Thanks for the detailed response! Ill try the potential workaround and see if it works. Ill update issue with results.
Looks like its ngx-bootstrap. Error is |
Huh, I would not expect changing the Maybe double-check that you're starting from a working build with a clean (Admittedly, I don't use Angular much, so I could be off-base in my understanding of that error.) |
Setting moduleResolution to Bundler fails even after clean install.
Good news is that declaration file workaround does work, so I dont need to worry about switching to Bundler for the moment... |
In typescript (angular) application had been patching version 0.5.0 to include missing jsonpatch in exported formatters and was importing like this:
import { DiffPatcher, formatters } from 'jsondiffpatch';
and all was good. (tsconfig has esModuleInterop set to true)
Now after update to 6.0 not sure how to import. Either of these seems to compile but crashes when try to run:
The text was updated successfully, but these errors were encountered: