-
-
Notifications
You must be signed in to change notification settings - Fork 120
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
CommonJS Default Import missing / DEV MODE #482
Comments
same problem with
|
Sounds like it's extremely hard to solve. Hoped externalizing would help.
Hmm, this works. We'd need someone experienced with Vite. |
I was able to prevent the lodash error after installing import { cjsInterop } from 'vite-plugin-cjs-interop';
export default {
plugins: [
cjsInterop({
// List of CJS dependencies that require interop
dependencies: ['lodash'],
}),
],
};
I wasn't able to reproduce the dayjs issue myself so I'm curious if this fixes that as well @aheissenberger. Doesn't seem like a great long term solution. I'll continue looking further into waku's internal config. |
looks good to me for the current workaround > cjsInterop |
no improvement - I tested the plugin with this config: cjsInterop({
// List of CJS dependencies that require interop
dependencies: ['lodash','lodash/**','dayjs','dayjs/**'],
}), To be clear - the problem exists only in the javascript code which is loaded in dev mode in the hydration process. The server side rendered code works without an error and outputs the correct static html in dev mode, then the hydration kicks in and the error is thrown in the browser. I think the logic of the plugin could help but the plugin seems not to be called to transform the code required by the frontend in the hydration process. The documentation of the plugin states that it will only be called during the SSR process. I removed the vite cache in
As a next step I will try to create a simple test setup without the Mantine UI framework |
I found this additional options for the plugin - but then the plugin crashes: plugins: [
cjsInterop({
// List of CJS dependencies that require interop
dependencies: [
'dayjs'
],
client: true,
apply:'serve'
}),
], I debugged the crash of the The original error is gone, but I have now an other error:
|
The plugin is from @cyco130 which hast build his own ssr framework and worked with @nksaraf on a |
Can we close this since it's fixed in the upstream? |
ERROR in hydration process in browser - only in DEV MODE
pnpm waku dev --with-ssr
- build has no problems:original file - bundled:
The package
dayjs
package.json does not provide atype
nor does it provideexports
. Anesm
folder exists but is not detected by Vitejs.The script does not fail with
import dayjs from
, it fails with the deep import from plugin folder:import timezonePlugin from "/node_modules/.pnpm/dayjs@1.11.10/node_modules/dayjs/plugin/timezone.js?v=89918f44";
current vite config:
tsconfig.node.json
tsconfig.json
How can a change of vite DEV MODE config fix this problem?
The text was updated successfully, but these errors were encountered: