-
-
Notifications
You must be signed in to change notification settings - Fork 73
Open
Description
It'd be nice to update import statements so that the lib is easy to import with native ES Modules.
At the moment, this does not work:
<script type="importmap">
{
"imports": {
"@dimforge/rapier3d": "https://cdn.jsdelivr.net/npm/@dimforge/[email protected]/rapier.js"
}
}
</script>
<script type="module">
import * as RAPIER from '@dimforge/rapier3d'
</script>
This will fail with
GET https://cdn.jsdelivr.net/npm/@dimforge/[email protected]/exports net::ERR_ABORTED 404 (Not Found)
This is because https://cdn.jsdelivr.net/npm/@dimforge/[email protected]/exports
does not exist. The file https://cdn.jsdelivr.net/npm/@dimforge/[email protected]/exports.js
does exist, but appending .js
to URLs is not part of native ES Module behavior. A URL to JavaScript can be anything, and only the MIME type determines if it will be executed as JavaScript.
Solving this problem has a potentially easy solution: adding .js
to all import statements.
Metadata
Metadata
Assignees
Labels
No labels