-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incompatible with vite #14
Comments
Thanks, this is a helpful report. I think the first part might be a Cesium issue? There are a few gotchas with bundling Cesium certainly. I've struggled with the |
For the Cesium problem, at a glance it seems like a Cesium issue. This is a somewhat similar problem someone encountered for that problem: Their solution was to essentially resolve the I just setup a standalone vite project that imports cesium to see what happens and it does not encounter the same error.
Could it be that because cesium-martini is compiled as CommonJS, it loads the CJS version of Cesium. However, since I'm running vite it will try to load everything as a module. Maybe there needs to be an ESM version of cesium-martini to resolve this particular issue? For the I think if this is added to the top of
|
In addition to the fix in the PR, I also added this resolution in my
Ref: yarn resolutions |
Just saw on your Twitter you have been busy with another project - congrats! |
For anyone who might need it, a fork is available here. |
just an fyi that in that branch I also needed to set the package manager in the package json. I'm not sure why this wasn't needed before but may be something that you may run into. |
When trying to include
@macrostrat/cesium-martini
in a bare bones Vite project the following error occurs:You can see this in a very basic repro here (check your browser's dev console):
https://stackblitz.com/edit/vitejs-vite-pqnxx6?file=package.json,src%2FApp.jsx&terminal=dev
By hacking the cesium module to import the cesium module directly to bypass the error (import cesium using
cesium/Build/Cesium/Cesium
instead ofcesium
), then I see this error:It seems like I can workaround that with this -
yarn add -D regenerator-runtime
then:note: using the
@vitejs/plugin-legacy
didn't appear to workI think this can be resolved by adding
@babel/plugin-transform-runtime
to your project's babelrcThe text was updated successfully, but these errors were encountered: