-
Couldn't load subscription status.
- Fork 3.7k
Closed
Description
We use import.meta.url in buildModuleUrl to find the current module location and build CESIUM_BASE_URL. Apparently Edge won't even parse code with import.meta.url in it and silently fails without any kind of indication.
We may be able to avoid import.meta.url completely and take a different approach.
There's some other weirdness in buildModuleUrl as well that we may want to review since a lot has changed since it was written.
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
mramato commentedon Oct 3, 2019
This only affects the unbuilt versions of Cesium Viewer and Sandcastle on Edge. Built versions work as expected.
The main issue is that we ship the unbuilt versions in the Cesium release zip, the hosted versions on cesiumjs.org work fine.
hpinkos commentedon Oct 15, 2019
@mramato is this something you're going to take care of?
mramato commentedon Oct 16, 2019
I've looked into it, but at first glance Edge looks to be in worse shape than I thought. I was thinking of addressing this by having the Sandcastle we ship with Cesium always use CesiumUnminified instead of the built version, which would make it faster and work in Edge too (which is the only browser it currently has problems with).
hpinkos commentedon Oct 22, 2019
@mramato Should this still be marked
next-release? What's the plan?Remove import.meta.url usage
thw0rted commentedon Jan 26, 2021
To those watching: did you ever wind up digging into ways to work around the SyntaxError? I was just reading over webpack/webpack#7353 which talks about https://webpack.js.org/guides/asset-modules/#url-assets.
The short version is that Webpack is able to statically analyze
new URL("./somefile.ext", import.meta.url)and magically add the correct file to the bundle. They're recommending it as a path forward for libraries to reference their own assets in a fully cross platform way, which will work whether the module is included via a<script type="module">tag directly,imported from a consumer that's run through a bundler (well, Webpack 5+ at least), or in Node as MJS, all using the same code.This issue actually means there's two problems: this one, i.e. writing a polyfill/fallback that avoids the SyntaxError, and also the root cause of #8401, which is that the way Cesium handles asset references has too much indirection to support static analysis. I'm also commenting over there to explain what I mean by that.