vite-ssr
vite-ssr copied to clipboard
vite-ssr doesn't appear to be written in CJS, but also doesn't appear to be a valid ES module (i.e. it doesn't have "type": "module" or an .mjs extension for the entry point). Please contact the package author to fix.
"dependencies": { "@vueuse/head": "^0.7.6", "axios": "^0.26.1", "element-plus": "^2.1.9", "express": "^4.17.3", "pinia": "^2.0.13", "sass": "^1.50.0", "vite-ssr": "^0.16.0", "vue": "3", "vue-router": "4" }, "devDependencies": { "@types/node": "^17.0.24", "@vitejs/plugin-vue": "^2.3.1", "typescript": "^4.6.3", "vite": "^2.9.5", "vue-tsc": "^0.34.7" }
Make sure you set "type": "module"
in your packge.json
ok,Me Not paying attention to new changes
I had this problem too, and adding "type": "module" didn't fix it
me to
+1
You can safely ignore that warning for now. We will probably drop CJS support at some point (perhaps with Vite v3).
I found that adding module.exports = 'i love you'
to the index.js
of the package fixes the issue.
Looking into the vite code that logs the message, I found a regex check right before it logs.
The regex just checks for some key works for CJS
These are in a function called collectExternals
, I wasn't able to find the source in github.
Also found it could be fixed by just adding module.exports
as a comment