I’m working on cesium-webpack-app and want to use modules in ES6 style. I know how to import Cesium.js, but I can’t import stylesheet, ‘widget.css’.
I found this code below in QuickStart
import "cesium/Build/Cesium/Widgets/widgets.css";
But it doesn’t work. The error message is
Module not found: Error: Package path ./Build/Cesium/Widgets/widgets.css is not exported from package C:\***\cesium-webpack-app\node_modules\cesium (see exports field in C:\***\cesium-webpack-app\node_modules\cesium\package.json)
So, I changed ‘exports’ in node_modules/cesium/package.json like this.
"exports": {
"./package.json": "./package.json",
"./Build/Cesium/Widgets/widgets.css": "./Build/Cesium/Widgets/widgets.css", <=added
".": {
"require": "./index.cjs",
"import": "./Source/Cesium.js"
}
}
and this work to me.
Is it right solution?