<?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 Nuxt 3 - Server Side Rendering / Client Only - 500 Element Is Not Defined in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/nuxt-3-server-side-rendering-client-only-500/m-p/1348113#M82748</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I'm trying to get a Nuxt 3 / ArcGIS Maps SDK application off the ground, but having a hard time getting the Map.vue component to render as a &amp;lt;ClientOnly&amp;gt;&amp;lt;Map /&amp;gt;&amp;lt;/ ClientOnly&amp;gt; with server side rendering functioning for the rest of the app. I'm getting the error 500 element is not defined. I've tried to match the example configs from the esri &lt;A href="https://github.com/benelan/arcgis-esm-samples/tree/main/nuxtjs-arcgis-core" target="_self"&gt;github repo&lt;/A&gt;, but its written in Nuxt 2, and doesn't seem to work. My app will work if you set 'ssr: false' in nuxt.config.ts&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;export default &lt;/SPAN&gt;&lt;SPAN&gt;defineNuxtConfig&lt;/SPAN&gt;({&lt;BR /&gt;  &lt;SPAN&gt;devtools&lt;/SPAN&gt;: { &lt;SPAN&gt;enabled&lt;/SPAN&gt;: &lt;SPAN&gt;true &lt;/SPAN&gt;},&lt;BR /&gt;  &lt;SPAN&gt;modules&lt;/SPAN&gt;: [&lt;BR /&gt;    &lt;SPAN&gt;'@pinia/nuxt'&lt;/SPAN&gt;,&lt;BR /&gt;    &lt;SPAN&gt;'vuetify-nuxt-module'&lt;BR /&gt;&lt;/SPAN&gt;  ],&lt;BR /&gt;  &lt;SPAN&gt;css&lt;/SPAN&gt;: [&lt;SPAN&gt;'~/assets/css/main.css'&lt;/SPAN&gt;],&lt;BR /&gt;  &lt;SPAN&gt;build&lt;/SPAN&gt;: {&lt;BR /&gt;    &lt;SPAN&gt;transpile&lt;/SPAN&gt;: [&lt;SPAN&gt;'@arcgis/core'&lt;/SPAN&gt;]&lt;BR /&gt;  },&lt;BR /&gt;  // Uncomment to get app to work&lt;BR /&gt;  // &lt;SPAN&gt;ssr&lt;/SPAN&gt;: &lt;SPAN&gt;false&lt;/SPAN&gt;,&lt;BR /&gt;});&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;The repo for my boilerplate project is attached &lt;A href="https://github.com/tfjackc/nuxt3-surveys" target="_self"&gt;here&lt;/A&gt;. If anyone has some time to look over the code and let me know where the map rendering is breaking that would be a huge help. I would also be happy to add more information here about anything if need be.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jack&lt;/P&gt;</description>
    <pubDate>Fri, 10 Nov 2023 04:10:02 GMT</pubDate>
    <dc:creator>colpittJack</dc:creator>
    <dc:date>2023-11-10T04:10:02Z</dc:date>
    <item>
      <title>Nuxt 3 - Server Side Rendering / Client Only - 500 Element Is Not Defined</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/nuxt-3-server-side-rendering-client-only-500/m-p/1348113#M82748</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I'm trying to get a Nuxt 3 / ArcGIS Maps SDK application off the ground, but having a hard time getting the Map.vue component to render as a &amp;lt;ClientOnly&amp;gt;&amp;lt;Map /&amp;gt;&amp;lt;/ ClientOnly&amp;gt; with server side rendering functioning for the rest of the app. I'm getting the error 500 element is not defined. I've tried to match the example configs from the esri &lt;A href="https://github.com/benelan/arcgis-esm-samples/tree/main/nuxtjs-arcgis-core" target="_self"&gt;github repo&lt;/A&gt;, but its written in Nuxt 2, and doesn't seem to work. My app will work if you set 'ssr: false' in nuxt.config.ts&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;export default &lt;/SPAN&gt;&lt;SPAN&gt;defineNuxtConfig&lt;/SPAN&gt;({&lt;BR /&gt;  &lt;SPAN&gt;devtools&lt;/SPAN&gt;: { &lt;SPAN&gt;enabled&lt;/SPAN&gt;: &lt;SPAN&gt;true &lt;/SPAN&gt;},&lt;BR /&gt;  &lt;SPAN&gt;modules&lt;/SPAN&gt;: [&lt;BR /&gt;    &lt;SPAN&gt;'@pinia/nuxt'&lt;/SPAN&gt;,&lt;BR /&gt;    &lt;SPAN&gt;'vuetify-nuxt-module'&lt;BR /&gt;&lt;/SPAN&gt;  ],&lt;BR /&gt;  &lt;SPAN&gt;css&lt;/SPAN&gt;: [&lt;SPAN&gt;'~/assets/css/main.css'&lt;/SPAN&gt;],&lt;BR /&gt;  &lt;SPAN&gt;build&lt;/SPAN&gt;: {&lt;BR /&gt;    &lt;SPAN&gt;transpile&lt;/SPAN&gt;: [&lt;SPAN&gt;'@arcgis/core'&lt;/SPAN&gt;]&lt;BR /&gt;  },&lt;BR /&gt;  // Uncomment to get app to work&lt;BR /&gt;  // &lt;SPAN&gt;ssr&lt;/SPAN&gt;: &lt;SPAN&gt;false&lt;/SPAN&gt;,&lt;BR /&gt;});&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;The repo for my boilerplate project is attached &lt;A href="https://github.com/tfjackc/nuxt3-surveys" target="_self"&gt;here&lt;/A&gt;. If anyone has some time to look over the code and let me know where the map rendering is breaking that would be a huge help. I would also be happy to add more information here about anything if need be.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jack&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2023 04:10:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/nuxt-3-server-side-rendering-client-only-500/m-p/1348113#M82748</guid>
      <dc:creator>colpittJack</dc:creator>
      <dc:date>2023-11-10T04:10:02Z</dc:date>
    </item>
    <item>
      <title>Re: Nuxt 3 - Server Side Rendering / Client Only - 500 Element Is Not Defined</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/nuxt-3-server-side-rendering-client-only-500/m-p/1348386#M82754</link>
      <description>&lt;P&gt;SSR and these "client" renderers are a little odd in some frameworks. So yes, those client components are rendered, but in some cases they are still loaded during ssr. I think Nuxt will automatically load js, even if not rendered from "components" folders. Looks like there are some tricks around this, but I always default to dynamic loading. This will work in your case.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const BASEMAP = "topo-vector";

export async function initialize(container: HTMLDivElement) {
  const [{ default: Map }, { default: MapView }, { default: Home }] =
    await Promise.all([
      import("@arcgis/core/Map"),
      import("@arcgis/core/views/MapView"),
      import("@arcgis/core/widgets/Home"),
    ]);

  const map = new Map({
    basemap: BASEMAP,
    // layers: [landGroup]
  });

  const view = new MapView({
    map,
    container,
    zoom: 10,
    center: [-120.8345, 44.2998],
    popupEnabled: true,
    popup: {
      dockEnabled: true,
      dockOptions: {
        // dock popup at bottom-right side of view
        buttonEnabled: true,
        breakpoint: true,
        position: "bottom-right",
      },
    },
  });

  const homeWidget = new Home({
    view: view,
  });

  view.ui.add(homeWidget, "top-left");

  await view.when();
  return view.when();
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Nov 2023 16:14:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/nuxt-3-server-side-rendering-client-only-500/m-p/1348386#M82754</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2023-11-11T16:14:25Z</dc:date>
    </item>
    <item>
      <title>Re: Nuxt 3 - Server Side Rendering / Client Only - 500 Element Is Not Defined</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/nuxt-3-server-side-rendering-client-only-500/m-p/1348412#M82755</link>
      <description>&lt;P&gt;Thanks for taking the time to look this over. It works just like you mentioned. Much appreciated!&lt;/P&gt;</description>
      <pubDate>Sat, 11 Nov 2023 23:12:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/nuxt-3-server-side-rendering-client-only-500/m-p/1348412#M82755</guid>
      <dc:creator>colpittJack</dc:creator>
      <dc:date>2023-11-11T23:12:41Z</dc:date>
    </item>
  </channel>
</rss>

