<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Svelte Kit Build Error in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/svelte-kit-build-error/m-p/1193629#M77979</link>
    <description>&lt;P&gt;Apparently my build error was related the the issue above because after the fix was merged and I installed the latest release with `npm install&amp;nbsp;@sveltejs/kit@1.0.0-next.381` the production build worked both with the auto and static adaptors!!!&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 19 Jul 2022 19:45:16 GMT</pubDate>
    <dc:creator>Sage</dc:creator>
    <dc:date>2022-07-19T19:45:16Z</dc:date>
    <item>
      <title>Svelte Kit Build Error</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/svelte-kit-build-error/m-p/1123928#M75521</link>
      <description>&lt;P&gt;I started messing around with Svelte and specifically SvelteKit.&amp;nbsp; My goal was just to see if I could make a simple mapview component.&amp;nbsp; I ran into error when the app tries to build:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;Named export 'commitAssetPath' not found. The requested module '@esri/calcite-components/dist/custom-elements/utils.js' is a CommonJS module, which may not support all module.exports as named exports.&lt;BR /&gt;CommonJS modules can always be imported via the default export, for example using:&lt;/P&gt;&lt;P&gt;import pkg from '@esri/calcite-components/dist/custom-elements/utils.js';&lt;BR /&gt;const {commitAssetPath: s}from"@esri/calcite-components/dist/custom-elements/utils.js";import{getAssetUrl: t}from"../../assets.js";import"../../core/has.js";import{makeAbsolute: o}from"../../core/urlUtils.js";let e;function m(){s(o(t(e)))}e="components/assets";export{m: commitAssetPath} = pkg;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;It looks like calcite is a dependency in&amp;nbsp;@arcgis/core/widgets/support/componentsUtils.js&lt;/P&gt;&lt;P&gt;This is the very simplistic component I wrote, there could be other issues as I'm just learning svelte but it seems like SvelteKit and arcgis might not play well together...&amp;nbsp; Any advise would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;script&amp;gt;
  import { onMount } from 'svelte'

  import Map from '@arcgis/core/Map'
  import MapView from '@arcgis/core/views/MapView'

  export let basemap = 'streets'
  export let center = [0, 0]

  let viewContainer

  onMount(async () =&amp;gt; {
    const view = new MapView({
      container: viewContainer,
      map: new Map({
        basemap,
      }),
      center,
    })
  })
&amp;lt;/script&amp;gt;

&amp;lt;h1&amp;gt;MapView&amp;lt;/h1&amp;gt;
&amp;lt;div id="viewContainer" bind:this={viewContainer} /&amp;gt;

&amp;lt;style&amp;gt;
  #viewContainer {
    width: 100%;
    height: 100%;
  }
&amp;lt;/style&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is a public GitHub repo for this project:&amp;nbsp;&lt;A href="https://github.com/sagewall/svelte-arcgis" target="_blank"&gt;https://github.com/sagewall/svelte-arcgis&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Dec 2021 17:53:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/svelte-kit-build-error/m-p/1123928#M75521</guid>
      <dc:creator>Sage</dc:creator>
      <dc:date>2021-12-08T17:53:36Z</dc:date>
    </item>
    <item>
      <title>Re: Svelte Kit Build Error</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/svelte-kit-build-error/m-p/1147261#M76463</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/505008"&gt;@Sage&lt;/a&gt;&amp;nbsp;have you found a solution for this yet? I'm running into the same issue.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Feb 2022 21:40:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/svelte-kit-build-error/m-p/1147261#M76463</guid>
      <dc:creator>ColbyHemond</dc:creator>
      <dc:date>2022-02-23T21:40:14Z</dc:date>
    </item>
    <item>
      <title>Re: Svelte Kit Build Error</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/svelte-kit-build-error/m-p/1147315#M76465</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/564346"&gt;@ColbyHemond&lt;/a&gt;&amp;nbsp;&amp;nbsp;I haven't for a solution for the build error.&amp;nbsp; I just moved onto other things for the time being and was going to revisit this sometime in the future.&amp;nbsp; I'd really like to be able to use the ArcGIS API for JavaScript in a SvelteKit application though.&amp;nbsp; Svelte is quickly becoming one of my favorite things.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Feb 2022 23:03:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/svelte-kit-build-error/m-p/1147315#M76465</guid>
      <dc:creator>Sage</dc:creator>
      <dc:date>2022-02-23T23:03:56Z</dc:date>
    </item>
    <item>
      <title>Re: Svelte Kit Build Error</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/svelte-kit-build-error/m-p/1184905#M77735</link>
      <description>&lt;P&gt;I am also running into this issue. It appears that Vite and commonJS do not get along well, and that `@arcgis/core` imports a file that it thinks is commonJS. `/node_modules/@arcgis/core/widgets/support/componentsUtils.js` imports from `@esri/calcite-components/` where "type": "module" is not set in the package.json and specifically it references `@esri/calcite-components/dist/components/index.js` which is a stencilJs component. The stencilJS component's root index.js references ESM modules... but svelteKit/Vite seem to think the package is commonJS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you follow the error warning and change the import in `componentsUtils.js` to&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; //import{setAssetPath as o}from"@esri/calcite-components/dist/components/index.js";&lt;BR /&gt;&amp;nbsp; &amp;nbsp; import pkg from '@esri/calcite-components/dist/components/index.js';&lt;BR /&gt;&amp;nbsp; &amp;nbsp; const o = pkg.setAssetPath;&lt;/P&gt;&lt;P&gt;it appears to work. However, you will run into further issues in `node_modules/@arcgis/core/widgets/support/chartUtils.js` importing from `@esri/calcite-colors`.&lt;/P&gt;&lt;P&gt;I'll post if I get it working...&lt;/P&gt;&lt;P&gt;I created a vite project based on&amp;nbsp;&lt;A href="https://odoe.net/blog/vite-jsapi" target="_blank"&gt;https://odoe.net/blog/vite-jsapi&lt;/A&gt;&amp;nbsp;and it works just fine.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2022 02:50:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/svelte-kit-build-error/m-p/1184905#M77735</guid>
      <dc:creator>Diesel</dc:creator>
      <dc:date>2022-06-22T02:50:49Z</dc:date>
    </item>
    <item>
      <title>Re: Svelte Kit Build Error</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/svelte-kit-build-error/m-p/1193310#M77962</link>
      <description>&lt;P&gt;Use dynamic imports in the onMount block&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;script lang="ts"&amp;gt;
	import { onMount } from 'svelte';

	onMount(async () =&amp;gt; {
		const Map = (await import('@arcgis/core/Map')).default;
		const MapView = (await import('@arcgis/core/views/MapView')).default;

		const map = new Map({
			basemap: 'gray-vector'
		});

		const view = new MapView({
			container: 'viewDiv',
			map: map
		});

		view.when(() =&amp;gt; {
			console.debug('Map loaded');
		});
	});
&amp;lt;/script&amp;gt;

&amp;lt;div id="viewDiv" /&amp;gt;

&amp;lt;style&amp;gt;
	@import '@arcgis/core/assets/esri/themes/light/main.css';
    
	#viewDiv {
		min-height: 500px;
	}
&amp;lt;/style&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2022 10:34:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/svelte-kit-build-error/m-p/1193310#M77962</guid>
      <dc:creator>DimasPutra</dc:creator>
      <dc:date>2022-07-19T10:34:04Z</dc:date>
    </item>
    <item>
      <title>Re: Svelte Kit Build Error</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/svelte-kit-build-error/m-p/1193439#M77966</link>
      <description>&lt;P&gt;Dynamic imports did work. Thank you!&lt;/P&gt;&lt;P&gt;Does the dynamic import remove tree-shaking from the imported `@arcgis` modules?&lt;/P&gt;&lt;P&gt;Also, do you think normal imports will work once the commonJS modules which `@arcgis` uses as dependencies are removed like a regular Svelte app? Or in SvelteKit will this always be the solution? Thank you again!&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2022 15:02:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/svelte-kit-build-error/m-p/1193439#M77966</guid>
      <dc:creator>Diesel</dc:creator>
      <dc:date>2022-07-19T15:02:47Z</dc:date>
    </item>
    <item>
      <title>Re: Svelte Kit Build Error</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/svelte-kit-build-error/m-p/1193488#M77968</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/604038"&gt;@DimasPutra&lt;/a&gt;!&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2022 15:54:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/svelte-kit-build-error/m-p/1193488#M77968</guid>
      <dc:creator>Sage</dc:creator>
      <dc:date>2022-07-19T15:54:05Z</dc:date>
    </item>
    <item>
      <title>Re: Svelte Kit Build Error</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/svelte-kit-build-error/m-p/1193620#M77978</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/604038"&gt;@DimasPutra&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/113504"&gt;@Diesel&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does running `npm run build` work for you?&lt;/P&gt;&lt;P&gt;The dynamic imports seemed to have fixed any build issues on the dev server `npm run dev` for me. However, I've tried the production build command with a few different build adapters (static and netlify) and ended up with a new error regardless of the adapter used. I wonder if it's just me or if you all might see the same error when trying to run `npm run build`?&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;[vite-plugin-svelte-kit] Maximum call stack size exceeded&lt;BR /&gt;error during build:&lt;BR /&gt;RangeError: Maximum call stack size exceeded&lt;/P&gt;&lt;P&gt;If it's not something local to me, it may be related to this issue on SvelteKit about large dynamic imports: &lt;A href="https://github.com/sveltejs/kit/issues/5399" target="_self"&gt;https://github.com/sveltejs/kit/issues/5399&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2022 19:14:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/svelte-kit-build-error/m-p/1193620#M77978</guid>
      <dc:creator>Sage</dc:creator>
      <dc:date>2022-07-19T19:14:23Z</dc:date>
    </item>
    <item>
      <title>Re: Svelte Kit Build Error</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/svelte-kit-build-error/m-p/1193629#M77979</link>
      <description>&lt;P&gt;Apparently my build error was related the the issue above because after the fix was merged and I installed the latest release with `npm install&amp;nbsp;@sveltejs/kit@1.0.0-next.381` the production build worked both with the auto and static adaptors!!!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2022 19:45:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/svelte-kit-build-error/m-p/1193629#M77979</guid>
      <dc:creator>Sage</dc:creator>
      <dc:date>2022-07-19T19:45:16Z</dc:date>
    </item>
    <item>
      <title>Re: Svelte Kit Build Error</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/svelte-kit-build-error/m-p/1193934#M77992</link>
      <description>&lt;P&gt;Yes it works for me, but with the async import the page is 338kB.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2022 14:09:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/svelte-kit-build-error/m-p/1193934#M77992</guid>
      <dc:creator>Diesel</dc:creator>
      <dc:date>2022-07-20T14:09:39Z</dc:date>
    </item>
  </channel>
</rss>

