-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
build error faunadb: require is not defined / Cannot read property 'custom' of undefined #2862
Comments
Duplicate of #2598 |
I think you can solve this problem by upgrading vite version to 2.1.5 |
@anncwb I am already using 2.1.5. edit: adjusted system information and example repository. |
Sorry, the two issue are not the same |
I get a very similar "require is not defined" error but only on the |
@gryphonmyers, also with faunadb? |
Sadly I encounter this issue as well and I am at a complete loss where to go from here. unlike gryphonmyers above the issue persists across server restarts. |
@jardaroh, same here... |
As a really dirty workaround I used https://github.com/wessberg/cjstoesm/ to convert the faunadb module to esm. I copied it to my lib folder and removed all the imports. It's really dirty, but it's working. |
@Shinigami92, how are your plans about dealing with cjs modules? |
I'm the wrong person to ask that 🙂 I would suggest to ask in Vite Land |
Nope it's a different CJS package |
Good news: |
After updating to the current ESM version, i am getting the following error on build: If I replace every export { default as Client } from './XXXX' with export { default as Client } from './XXXX.js' It is working.... dev is working fine without any modifications to the module. |
You cannot add CommonJS dependencies to There's a PR that will clarify this in the docs: #3961 |
This issue gets locked because it has been closed for more than 14 days. |
Describe the bug
I created a new svelte-kit app, which will execute a faunadb query via netlify function.
A small example can be found here: https://github.com/BetaConnector/sveltekit-test
On npm run dev, vite shows me the following exception:
on npm run build i get a different exception:
It seems that vite hat trouble with the node module.
Since the the modules is used on a netlify function I am setting the following option:
I even tried to exclude the optimization - without any success:
The guys of svelte told me to address this ticket to you guys...
I would be glad if you guys could support me on this because faunadb is essentially the database of netlify - this is a show stopper right now.
Thanks in advanced - Alex
Reproduction
clone the repository https://github.com/BetaConnector/sveltekit-test
start the app via
also
System Info
Used package manager: npm
Logs
The text was updated successfully, but these errors were encountered: