-
Notifications
You must be signed in to change notification settings - Fork 137
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
Experimental Minification produces unexpected "??" errors #151
Comments
I updated the version of esbuild used by next-on-pages and got a more descriptive error message for the With version 0.17.14 of esbuild, the error message is Full output
I suspect this may something to do with the fact that The issue can be reproduced by cloning this repo, checking out a commit and running the commands in the readme. git clone git@github.com:mattddean/next-pages.git
cd next-pages
git checkout e5e8b258164e04053e86932093af77184a77d545 |
UpdateI've found the issue, when we process a js to dedupe its chunks we parse it using acorn and obtain an AST representation of the javascript, we then use astring to convert that into js code that we save it in our chunk files. The issue is that astring doesn't seem to produce correct outputs for expressions containing both I'm going to open an issue in the astring repo as far as I can tell there isn't much we can do on our side for this (unless we decide to switch the library we use to generate the js code) Detailed ExampleFor example if I have the following expression: const a= x && ( y ?? z ); such generates the following AST tree:
(as you can check using astexplorer) If I then pass this to the astring generate method this is what the resulting code looks like: const a = x && y ?? z; as you can see from this stackblitz |
@mattddean can't thank you enough for your repository, that's been extremely helpful for finding the issue, thanks! ❤️ |
PS: there is already an issue in the |
Update: I've created a PR in the (although we might need more advanced codemod tools with better typing than acorn/astring so we might actually more away from astring entirely 🤔) |
resolves cloudflare#151
resolves cloudflare#151
resolves cloudflare#151
resolves cloudflare#151
resolves cloudflare#151
* remove use of astring resolves #151
With our project (which was started from https://github.com/shadowwalker/next-pwa)
npx @cloudflare/next-on-pages
works without the--experimental-minifynode
but when I add it there are 6 errors, all of which are justUnexpected "??"'
. Looks like it's the same error as mentioned above: #2 (comment)However Cloudflare Pages doesn't work, even without the
--experimental-minifynode
because ofError: Failed to publish your Function. Got error: Error: Script startup exceeded CPU time limit.
. I can't figure out how to fix this yet but think it's unrelated to@cloudflare/next-on-pages
Details
package.json
Error log
The text was updated successfully, but these errors were encountered: