Skip to content
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

🐛 BUG: Including wrangler in dev dependencies crashes preview, (Shiki) Node specifics being run/bundled #4061

Closed
1 task
davycoe opened this issue Jul 26, 2022 · 4 comments
Assignees

Comments

@davycoe
Copy link

davycoe commented Jul 26, 2022

What version of astro are you using?

1.0.0-beta.73 || 1.0.0-rc.1

Are you using an SSR adapter? If so, which one?

Cloudflare 0.3.0

What package manager are you using?

yarn

What operating system are you using?

Linux

Describe the Bug

Crashes when running preview "preview": "wrangler pages dev dist/"

Seems related to Shiki syntax highlighter.

[coe@arch plz]$ yarn preview                                                                                                                                           
yarn run v1.22.19                                                                                                                                                      
$ wrangler pages dev dist/                                                                                                                                             
🚧 'wrangler pages <command>' is a beta command. Please report any issues to https://github.com/cloudflare/wrangler2/issu                                              es/new/choose                                                                                                                                                          
╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮                                              
│ [b] open a browser, [d] open Devtools, [c] clear console, [x] to exit                                                 │                                              
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯                                              
✘ [ERROR] [plugin checkForNodeBuiltins] Detected a Node builtin module import while Node compatibility is disabled.
Add node_compat = true to your wrangler.toml file to enable Node compatibility.

    node_modules/shiki/dist/index.esm.js:1639:33:
      1639 │             const path = require('path');
           ╵                                  ~~~~~~

  This error came from the "onResolve" callback registered here:

    node_modules/wrangler/wrangler-dist/cli.js:114397:11:
      114397 │     build6.onResolve({
             ╵            ~~~~~~~~~

    at setup (/home/coe/code/plz/node_modules/wrangler/wrangler-dist/cli.js:114397:12)
    at handlePlugins (/home/coe/code/plz/node_modules/wrangler/node_modules/esbuild/lib/main.js:843:23)
    at Object.buildOrServe (/home/coe/code/plz/node_modules/wrangler/node_modules/esbuild/lib/main.js:1137:7)
    at /home/coe/code/plz/node_modules/wrangler/node_modules/esbuild/lib/main.js:2085:17
    at new Promise (<anonymous>)
    at Object.build (/home/coe/code/plz/node_modules/wrangler/node_modules/esbuild/lib/main.js:2084:14)
    at Object.build (/home/coe/code/plz/node_modules/wrangler/node_modules/esbuild/lib/main.js:1931:51)
    at bundleWorker (/home/coe/code/plz/node_modules/wrangler/wrangler-dist/cli.js:114434:33)
    at build6 (/home/coe/code/plz/node_modules/wrangler/wrangler-dist/cli.js:114544:17)

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-bcdncf?file=package.json

Participation

  • I am willing to submit a pull request for this issue.
@davycoe
Copy link
Author

davycoe commented Jul 26, 2022

Just to add running Wrangler from global bin works as expected.
example: wrangler2 pages dev dist/

@matthewp
Copy link
Contributor

Thanks! This is an interesting, I'll investigate.

@matthewp
Copy link
Contributor

This might get fixed by #4072. Going to test afterwards.

@davycoe
Copy link
Author

davycoe commented Jul 29, 2022

All seems to be working now I've upgraded the to the latest:

  • astro@1.0.0-rc.2
  • @astrojs/cloudflare@0.4.0

Thanks! 🚀

@davycoe davycoe closed this as completed Jul 29, 2022
@matthewp matthewp self-assigned this Jul 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants