s3xysteak / vite-plugin-cesium-build

A devDependencies used to automatically configure CesiumJS for development and build with Vite.
MIT License
18 stars 2 forks source link

ReferenceError: module is not defined #12

Closed murithigeo closed 1 month ago

murithigeo commented 1 month ago

I'm getting a ReferenceError: module is not defined on a pure create-svelte install.

[vite] Error when evaluating SSR module /node_modules/.vite-plugin-externals/cesium.js: |- ReferenceError: module is not defined at C:\Users\users\Desktop\projects\coveragejsonTestBed\node_modules.vite-plugin-externals\cesium.js:1:8

s3xysteak commented 1 month ago

I will check it later. There is a svelte exapmle, which is also created by create-svelte. I just try it and it worked correctly. I think maybe there are some break changes in create-svelte.

murithigeo commented 1 month ago

I've checked and it happens when the module is SSRd.

s3xysteak commented 1 month ago

I'm sorry to say the plugin is just cannot work on sveltekit now. This plugin is using transformIndexHtml hook, but refer to the vite document, the hook could not work on sveltekit. I will keep this issue open, maybe I can find a solution in the future.

This hook won't be called if you are using a framework that has custom handling of entry files (for example SvelteKit).

s3xysteak commented 1 month ago

I add an example for svelte-kit: https://github.com/s3xysteak/vite-plugin-cesium-build/tree/main/examples/svelte-kit It looks good to me. If you still have any problem, feel free to reopen the issue!