I'm encountering a really frustrating issue trying to use Vitest with the ArcGIS JS API. Currently I have to mock every view that utilises anything from calcite in order to get Vitest to work for me, otherwise it fails 100% of the time.
It looks like there is an issue with how Vitest interacts with the imports of Stencil JS. Has anyone encountered this? Its been an issue for at least 6 month or so.
SyntaxError: Named export 'getAssetPath' not found. The requested module '@stencil/core/internal/client/index.js' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from '@stencil/core/internal/client/index.js';
const { getAssetPath, setAssetPath, setNonce, setPlatformOptions } = pkg;
Solved! Go to Solution.
It looks like this question has already been posted to calcite-design-system github repository. That's the best location to ask questions about Calcite and Stencil: https://github.com/Esri/calcite-design-system/issues/5077#issuecomment-1794811657.
It looks like this question has already been posted to calcite-design-system github repository. That's the best location to ask questions about Calcite and Stencil: https://github.com/Esri/calcite-design-system/issues/5077#issuecomment-1794811657.
Thanks Andy - I'll continue my communications on there!
I posted on here as there does seem to be a cross-post back to esri community (https://community.esri.com/t5/arcgis-api-for-javascript-questions/svelte-kit-build-error/m-p/1123928) where someone did previously create a potential work around, though I haven't had any success using it myself.