-
Notifications
You must be signed in to change notification settings - Fork 889
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
With statements cannot be used with the "esm" output format due to strict mode #378
Comments
Having the same problem |
1 similar comment
Having the same problem |
There are some packaging changes in the master, so I'd like to ask you to try it first, i.e.: "dependencies": {
"turndown": "github:domchristie/turndown"
} If the issue is still present, please provide a minimum buildable example reproducing the issue. Including:
Thank you! |
Hi @martincizek The entry points for There is no lib folder like referenced here in package.json from master:
|
@martincizek solution works for me |
@damianmozniak not sure how since there is no |
@callmeberzerker |
So it seems it was PR #335 what fixes this (merged but not released to npmjs). We're currently in a process of transferring Turndown under a new organisation and I hope I'll be able to release a new npm package soon. |
The maintainer published a temp branch see here: #378 (comment) |
@callmeberzerker Not sure how this differ from the current master. I see three commits in your fork:
Are you sure that the result is any different from using just: "dependencies": {
"turndown": "github:domchristie/turndown"
} ? P.S. Don't forget to |
Hi @martincizek As I explained in previous comment, I am not using |
I see. Not very familiar with I've created a temporary branch with pre-built artifacts as a workaround until a new npm package is published. Would you mind to test it? Workaround for yarn version 1: "dependencies": {
"turndown": "github:domchristie/turndown#build-7.1"
} |
First of all, thanks a lot for your prompt feedback and communication! I can definitely confirm that it works with your branch -> I will edit my above comment to point your comment. I know the whole node/js ecosystem is hurting big now with the esm/module/main semi-standardization going on now which is hell for lib authors and users - but we will get through it somehow! Once again thanks a lot! |
Since my bug is fixed, and everyone else seems to be happy too, I'll close the issue :D |
@callmeberzerker @cheetahbyte Release It should now be just: "dependencies": {
"turndown": "^7.1.0"
} |
I created the patch file: diff --git a/node_modules/domino/lib/sloppy.js b/node_modules/domino/lib/sloppy.js
which I deploy to the server by adding as a package.json script. This solved the problem for me. |
same error |
In html-parser.js var domino = require('domino')
Parser.prototype.parseFromString = function (string) {
return domino.createDocument(string)
} to import('domain').then(domino=>{
Parser.prototype.parseFromString = function (string) {
return domino.createDocument(string)
}
}) |
Hi, I encountered the same error when I tried to migrate my nextjs app to use their new app router system. The problem appears when |
Hi, I upgraded a bunch of dependencies in my Nuxt project and this bug broke the Netlify build with this message I was using Removing turndown from my project fixed the deployment |
…he app in nextjs 13 with app router mixmark-io/turndown#378
…he app in nextjs 13 with app router mixmark-io/turndown#378
× With statement are not allowed in strict mode
tried
|
have you found any solution? |
have you find any solution? |
The domino library looks abandoned and had compatibility issues with the latest nextjs versions. Luckily, turndownjs accepts a JSDOM document as input and not only raw text. Workaround for: * mixmark-io/turndown#439 (occurred after upgrading nextjs from 13.4 to 13.5) * mixmark-io/turndown#378 (occurred after upgrading nextjs from 12.X to 13.X)
@Growmedigitally Not really fixed, but I managed to work around the problem by using JSDOM to bypass domino. You can have a look at this commit here: julienc91/caviardeul@75570c1 |
Still not working same issue .... |
also have the same issue when working with nextjs. Would it be possible to replace domino with JSDOM similar to what @julienc91 did in this repo? I can't do it since I'm not depending directly on turndown but postlight/parser -> turndown -> domino :( |
Next14 issue related to this here - vercel/next.js#34796 |
Sandbox to reproduce the error when using Next JS 14.0.2 or 14.0.3 (for 14.0.1 or older it seems to build successfully): https://codesandbox.io/p/devbox/next-14-0-2-domino-build-error-bug-dylymw (I encourage downloading the app and running locally, as the resources are quite constrained). As said in earlier comments, this is an issue with |
The package https://github.com/fgnass/domino that causes this error seems to be no longer maintained, so there is no hope that it will be fixed. If a DOM is needed from this package, perhaps https://github.com/capricorn86/happy-dom could be a lightweight alternative to JSDOM? I'd love to help and test it, but I'd like to know if there's any interest in getting rid of this problem at all? In the meantime, I've switched to https://github.com/crosstype/node-html-markdown as a workaround. It's pretty basic and also not up to date, but at least it works on AWS Lambda. |
Hi @zirkelc,
Any meaningful help is appreciated. For the final solution, I'd like the approach described in #290. But the domino is a current issue, so we shouldn't wait. We are actually in the same situation as with #353 back then. :-) So if you can try another parser, test it and do some perf tests, it would be nice. Alternatively, we can at least temporarily adopt this fork https://github.com/angular/domino, which might have the issues fixed (?) It is not intended for use as a public package, but we can fork it under mixmark-io and use it in a similar way as Angular uses it. |
Hi @martincizek I submitted PR #457 just to share some results. I added benchmark and Maybe there are other dies for parser that could be added to compare with EDIT: I added |
Thanks so much for this 💜. The angular fork does solve the issue. You can solve it by using:
Successfully deployed and working on Vercel. @datduyng 's repo he found, didn't quite work. But provided the needed inspiration for the workaround 🙏 |
The text was updated successfully, but these errors were encountered: