Open huang-julien opened 11 months ago
this issue seems to be introduced in 2.6 https://github.com/nuxt/nuxt/issues/23200#issuecomment-1718907167
Thanks for reporting it here! If you had a chance to scope it down to a minimal nitro only reproduction that would be great otherwise will check it soon if can find a solution for esm compatibility.
Here's the nitro reproduction 😃 https://stackblitz.com/edit/unjs-nitro-9kdgkw?file=package.json,utils%2Fapplicationinsights.ts,middleware%2Fapplicationinsights.ts,nitro.config.ts&title=Nitro%20Starter
We have some issues:
__dirname
being not defined. However it is not reproduced on nuxt 3.6.5 with 2.5.2. On the reproduction, this can be fixed with a replace to import.meta.url
Finally found the commit. Seems like upgrading mlly
from 1.4.0
to 1.4.1
causes this issue
well the current workaround for nitro and nuxt projects is to set the resolution of mlly
to 1.4.0
https://github.com/unjs/nitro/commit/f76f0daaeb965bad3706c8a4b2173dd4bf67f4c6
Any news on it?
@alimozdemir you can set the resolution of mlly
to 1.4.0
for now.
Finally found the commit. Seems like upgrading
mlly
from1.4.0
to1.4.1
causes this issuewell the current workaround for nitro and nuxt projects is to set the resolution of
mlly
to1.4.0
Maybe I'm misunderstanding something, but your linked stackblitz seem to throw the same exception in the terminal.
The same happens when I try it on my local machine.
Can you try with pnpm or yarn ? forcing the resolution
of mlly
to 1.4.0 doesn't seems to work with npm :(
Can you try with pnpm or yarn ? forcing the
resolution
ofmlly
to 1.4.0 doesn't seems to work with npm :(
Ah, that's unfortunate. In my case, I'm unable to use any other package manager.
Thanks for the quick reply!
Just popping by again to mention that the same can be achieved in npm by adding the following to package.json
:
"overrides": {
"mlly": "1.4.0"
}
and then running npm install
.
I'll get back if I figure out some better solution though!
Downgrading mlly to 1.4.0 doesn't work for me either. Unable to deploy our app :/
do you have a small reproduction please ?
Try to see if mlly has really been downgraded to 1.4.0 with pnpm/yarn/npm why
Hey! Thanks for a quick reply. I don't have a reproduction, but it's definitely a problem with an import of Sheet JS. Disabling the import completely fixes the build.
import * as XLSX from "xlsx"
package.json
"devDependencies": {
"@iconify/json": "^2.2.152",
"@nuxt/content": "^2.9.0",
"@nuxt/devtools": "latest",
"@nuxt/image": "^1.1.0",
"@nuxtjs/i18n": "^8.0.0-rc.7",
"@tailwindcss/typography": "^0.5.10",
"@types/node": "^20.10.3",
"mapbox-gl": "^3.0.0",
"nuxt": "^3.8.2",
"nuxt-gtag": "^1.1.1",
"nuxt-icon": "^0.6.6",
"prettier": "^3.1.0"
},
"dependencies": {
"@googleapis/sheets": "^5.0.5",
"@kgierke/nuxt-basic-auth": "^1.3.1",
"@medusajs/medusa-js": "^6.1.4",
"@nuxt/ui": "^2.11.0",
"@nuxtjs/algolia": "^1.10.1",
"@nuxtjs/google-fonts": "^3.1.0",
"@pinia/nuxt": "^0.5.1",
"@vueuse/components": "^10.7.0",
"@vueuse/core": "^10.7.0",
"@zag-js/editable": "^0.17.0",
"@zag-js/range-slider": "^0.17.0",
"@zag-js/tabs": "^0.17.0",
"@zag-js/vue": "^0.17.0",
"color": "^4.2.3",
"csvtojson": "^2.0.10",
"lodash": "^4.17.21",
"lodash-es": "^4.17.21",
"nuxt-mapbox": "^1.5.5",
"nuxt-svgo": "^3.7.0",
"pinia": "^2.1.7",
"postcss-custom-properties": "^13.3.2",
"slugify": "^1.6.6",
"typescript": "^5.3.2",
"vite-plugin-inspect": "^0.8.1",
"vue-tsc": "^1.8.25",
"xlsx": "^0.18.5",
"yup": "^1.3.2",
"yup-password": "^0.2.2"
},
"overrides": {
"vite-plugin-inspect": "0.7.38",
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.1/xlsx-0.20.1.tgz"
}
Environment
Operating System: Windows_NT Node Version: v16.20.0 Nuxt Version: 3.7.3 CLI Version: 3.8.3 Nitro Version: 2.6.3 Package Manager: yarn@1.22.19 Builder: - User Config: - Runtime Modules: - Build Modules: -
Reproduction
https://stackblitz.com/edit/nuxt-starter-z1b17v?file=server%2Futils%2Fapplicationinsights.ts,server%2Fmiddleware%2Fapplicationinsights.ts
Describe the bug
Hi 👋
Since 3.7, importing applicationinsights breaks the whole app. This was working with 3.6.5. I believe this is probably an issue with Nitro instead of Nuxt.
Why didn't microsoft release ESM for this package ? 😱
Additional context
cloned from https://github.com/nuxt/nuxt/issues/23200
Logs
No response