Open iforgetyounow opened 4 months ago
could you provide more detail or an example repo where this can be reproduced?
@tcampbPPU I've same problem and create a minimal repo : https://github.com/FabienVINCENT/issue-nuxt-dayjs Note: I use pnpm and it is indeed him who created the problem because with npm no problem
@FabienVINCENT what version of PNPM are you using? i am using 9.3.0
and cloned your example repo (thank you btw for that) and its building fine for me
pnpm 9.3.0
too
It's building but in console you have this error :
@FabienVINCENT add this to your package.json
file
"dayjs": "^1.11.11",
so in all you are looking like:
"devDependencies": {
"dayjs": "^1.11.11",
"dayjs-nuxt": "^2.1.9"
}
@FabienVINCENT idk why that extra import is needed but lmk if that at least clears up the error
Yes I found this hack yesterday it actually gets rid of the error
let me look into why thats needed and i can update the readme so others dont get stuck on this, but hope this satisfies for now
Even with this:
@FabienVINCENT add this to your
package.json
file"dayjs": "^1.11.11",
so in all you are looking like:
"devDependencies": { "dayjs": "^1.11.11", "dayjs-nuxt": "^2.1.9" }
I'm having the same error.
SyntaxError: The requested module '/_nuxt/node_modules/dayjs/plugin/arraySupport.js?v=f769ff9e' does not provide an export named 'default' (at dayjs.imports.mjs:12:8)
how can you fix this?
@RodrigoCarvalhoCode Based on this error message it appears to be a different error, are you using additional dayjs plugins? If so could you create a new issue and provide a sample repo or your config.
So I've solved in a hacky way, when I was building my project in SSR mode on build, I had import errors. So I've solved it by adding to build transpile, like
build: {
transpile: ['dayjs'],
And this fixed on build (for production), but it was raising that error that I've said before in local.
So I've tried checking if the process.env is production or not like
build: {
transpile: isProd? ['dayjs']: [],
And this did the trick. Don't understand why the build step would affect vite locally, but this solved it for now.
Uncaught SyntaxError: The requested module '/_nuxt/node_modules/.pnpm/dayjs@1.11.11/node_modules/dayjs/dayjs.min.js?v=f805e27d' does not provide an export named 'default' (at dayjs.imports.mjs:3:8)