TypeError: content is not a function #175
-
I currently have a project where I'm using vite + react. I have the
but get this error whenever I try to run the program:
I've tried other solutions to similar issues that pertain to different plugins but none seem to help. It may be a version clash issue of some sort but I can't be certain. In any case, here are my module versions:
Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 8 replies
-
Same issue here. Looks like it occurs as a result of me now needing to specify |
Beta Was this translation helpful? Give feedback.
-
I successfully reproduce this problem. You are setting To fix this, I need to configure require() of ES modules is not supported.
require() of /xxx/vite-plugin-content/dist/index.js from /xxx/googleFormClone/vite.config.ts is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /xxx/vite-plugin-content/package.json. This means all Currently I do not have other solutions for your problem. Feel free to give me some advices if you have. In short words, I do not have a good enough solution for your problem for now. My suggestion is to use |
Beta Was this translation helpful? Give feedback.
-
Update: I managed to find a solution from here. I just published |
Beta Was this translation helpful? Give feedback.
Same issue here. Looks like it occurs as a result of me now needing to specify
type: "module"
in mypackage.json
.