Skip to content

Can't manage to build with pre-rendering #1784

Answered by rschristian
anna1drz asked this question in Q&A
Discussion options

You must be logged in to vote

If you update your preact-cli version, you'll see a slightly better error message (something I worked on recently), pointing out the error is in /node_modules/form-data/lib/browser.js. To skip over the details, axios depends on another library called form-data which isn't doing something right. Just the import of axios is triggering this.

There's a few different solutions you can take:

  1. Use the fetch() API instead
    - fetch() is built into all modern browsers and should be faster & smaller than axios by a considerable margin. If you are following a tutorial or something (as you say you're a beginner), this is a bit of a different interface to axios, so may not be desirable.
  2. Use something like

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@anna1drz
Comment options

@rschristian
Comment options

Answer selected by rschristian
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants