Closed
Description
This is Cesium installed via npm
and integrated in a Svelte/Sapper
route.
npm install cesium
- Add a Svelte page to a Sapper basic demo app for the route
/cesium
which will load a basic CesiumViewer
. - run
npm run dev
The Svelte page
<script>
import { onMount } from 'svelte'
import "cesium/Build/Cesium/Widgets/widgets.css" // <= the first cesium import will cause the error !
onMount(async () => {
window.CESIUM_BASE_URL = 'http://localhost:3000/'
const { Viewer } = await import('cesium')
var viewer = new Viewer('cesiumContainer')
})
</script>
<style>
#cesiumContainer {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
}
</style>
<svelte:head>
<title>Cesium Demo</title>
</svelte:head>
<div id="cesiumContainer"></div>
The error message
Package subpath './package.json' is not defined by "exports" in /Users/xxx/repos/my_repo/node_modules/cesium/package.json
Workaround
Delete the exports
field in node_modules/cesium/package.json
.
Re-launch npm run dev
.
Metadata
Metadata
Assignees
Labels
No labels