-
-
Notifications
You must be signed in to change notification settings - Fork 105
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
TypeError: __require.resolve is not a function with svelte.config.cjs in an esm project #141
Comments
Looks like the error came from here:
Apparently, esbuild compiles this to var __require = (x) => {
if (typeof require !== "undefined")
return require(x);
throw new Error('Dynamic require of "' + x + '" is not supported');
}; Note, it's from the esm bundle, and esbuild doesn't assign A solution is to load the cjs variant of the svelte config too if we're in esm mode so we'd never reach that part of the code in esm. (the cjs bundle compiles just fine) As a workaround for now, you can convert the svelte config to |
Great thanks! Workaround helped. |
thanks for tackling this @bluwy I do recommend using esm for svelte.config.js if your surrounding project is esm too. But the linked PR is going to make it work anyways. |
updated the title to be a bit more descriptive. |
I have same error |
|
@bhojani3192 please file a new issue report and provide a reproduction |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
@bhojani3192 If you're not willing to do so, please ask for support in the Svelte discord. |
Describe the bug
I have ESM project. After the update 1.0.0-next.10 → 1.0.0-next.11 I start to get error:
My Vite config:
My Svelte config:
Reproduction
Logs
The text was updated successfully, but these errors were encountered: