Select to view content in your preferred language

Calcite/Stencil JS is breaking Vitest: Named export "getAssetPath" not found

2114
2
Jump to solution
11-06-2023 05:47 AM
JonnyDawe
New Contributor II

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;
1 Solution

Accepted Solutions
AndyGup
Esri Regular Contributor

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.

View solution in original post

2 Replies
AndyGup
Esri Regular Contributor

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.

JonnyDawe
New Contributor II

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.

0 Kudos