<?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: 'mapview-invalid-resource' images on map in electron in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapview-invalid-resource-images-on-map-in-electron/m-p/1499346#M84953</link>
    <description>&lt;P&gt;Thanks Andy,&amp;nbsp;&lt;/P&gt;&lt;P&gt;we found the issue is not related to vite or CSP. it's the similar issue like this one&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/responsetype-image-is-not-supported-in-web-workers/m-p/1018036" target="_blank"&gt;https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/responsetype-image-is-not-supported-in-web-workers/m-p/1018036&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;basically we get the error when `nodeIntegration = true`, turn it off solved the problem. our webpack app works is because we did something like&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;if (process.env.ELECTRON_ENV &amp;amp;&amp;amp; globalThis?.process?.versions?.v8) {
    const process = globalThis.process;
    const versions = process.versions;
    globalThis.process = ({
        ...process,
        versions: {
            ...versions,
            v8: undefined,
        },
        on: process.on,
        emit: process.emit,
    };
}&lt;/LI-CODE&gt;&lt;P&gt;so the host-hode check will return false.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 28 Jun 2024 20:15:02 GMT</pubDate>
    <dc:creator>JianglinWu</dc:creator>
    <dc:date>2024-06-28T20:15:02Z</dc:date>
    <item>
      <title>'mapview-invalid-resource' images on map in electron</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapview-invalid-resource-images-on-map-in-electron/m-p/1497253#M84926</link>
      <description>&lt;LI-CODE lang="javascript"&gt;import svgIcon from 'pathToSvgIocn.svg';

export const iconRenderer = {
    type: 'unique-value', 
    field: 'iconName',
    defaultSymbol: {
        type: 'simple-marker',
        style: 'square',
        color: '#c0c0c0',
        size: '32px',
    },
    uniqueValueInfos: [
      {
        value: 'Assigned, Inactive',
        symbol: {
            type: 'picture-marker',
            url: svgIcon,
            width: '32px',
            height: '32px',
        },
      },
    ],
    authoringInfo: undefined,
};

const eventFeatureLayer = new FeatureLayerConstructor({
        title: 'Events',
        source: [], 
        renderer: iconRenderer,
        objectIdField: 'objectId', 
        fields: [
            {
                name: 'iconName',
                alias: 'iconName',
                type: 'string',
            },
        ],
        outFields: ['*'],
        geometryType: 'point',
        labelingInfo: iconLabels,
        spatialReference,
        layerId: 999,
        id: '_events',
    });

    return eventFeatureLayer;
};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;there are other .svg, .png and .gif in 'uniqueValueInfos'&lt;/P&gt;&lt;P&gt;this code works fine on web, I'm able to see all icons on map correctly.&amp;nbsp;&lt;/P&gt;&lt;P&gt;however, when run the app in electron (tried with latest electron v31 and old electron v22), Im getting&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/107905i73AE3FDA8AC25E89/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;i also tried inline svg and external svg path when build with vite.&amp;nbsp; If i build svg as inline data&amp;amp;colon;image/svg+xml, above error shown.&amp;nbsp; if use external svg, the svg file is hosted on the same sub-domain. e.g. `demo.example.com/images/icon.svg`, then i will get the same error, saying could not fetch requested resource at `/images/icon.svg`&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for pngs/gifs, i get something similar&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image (1).png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/107906i41F5067982A25275/image-size/large?v=v2&amp;amp;px=999" role="button" title="image (1).png" alt="image (1).png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this only happens in electron with vite in production mode.&lt;/P&gt;&lt;P&gt;i have another window in the same version electron + same arcgis/core (tried both 4.28 and 4.30), but use webpack, that app works perfectly fine.&lt;/P&gt;&lt;P&gt;same electron version in dev mode also works. So i think there are something related to electron csp block the request, but it doesn't explain why it works fine with webpack bundler.&amp;nbsp;&lt;/P&gt;&lt;P&gt;current csp I used related to arcgis&lt;/P&gt;&lt;LI-CODE lang="markdown"&gt;default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' : https://*.arcgis.com https://*.arcgisonline.com; 
img-src 'self' about: data: blob: https://*.arcgis.com https://*.arcgisonline.com;
style-src 'self' 'unsafe-inline' blob: https://*.arcgis.com https://*.arcgisonline.com;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks in advance for any help.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jun 2024 17:38:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapview-invalid-resource-images-on-map-in-electron/m-p/1497253#M84926</guid>
      <dc:creator>JianglinWu</dc:creator>
      <dc:date>2024-06-25T17:38:44Z</dc:date>
    </item>
    <item>
      <title>Re: 'mapview-invalid-resource' images on map in electron</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapview-invalid-resource-images-on-map-in-electron/m-p/1497875#M84934</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/794134"&gt;@JianglinWu&lt;/a&gt;,&amp;nbsp; without a reproducible sample app it's&amp;nbsp; hard to say what the difference is between Vite and webpack in electron. Maybe take a look at the CSP settings recommended here: &lt;A href="https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/csp-header-setting/m-p/1289472/highlight/true#M81169" target="_blank"&gt;https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/csp-header-setting/m-p/1289472/highlight/true#M81169&lt;/A&gt;.&lt;BR /&gt;&lt;BR /&gt;You could also ask your Vite-specific question on one of the electron-vite communities: &lt;A href="https://github.com/orgs/electron-vite/repositories" target="_blank"&gt;https://github.com/orgs/electron-vite/repositories&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Please see our documentation on creating a minimal reproducible app: &lt;A href="https://developers.arcgis.com/javascript/latest/troubleshooting/#minimal-reproducible-application" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/troubleshooting/#minimal-reproducible-application&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jun 2024 20:10:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapview-invalid-resource-images-on-map-in-electron/m-p/1497875#M84934</guid>
      <dc:creator>AndyGup</dc:creator>
      <dc:date>2024-06-26T20:10:59Z</dc:date>
    </item>
    <item>
      <title>Re: 'mapview-invalid-resource' images on map in electron</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapview-invalid-resource-images-on-map-in-electron/m-p/1499346#M84953</link>
      <description>&lt;P&gt;Thanks Andy,&amp;nbsp;&lt;/P&gt;&lt;P&gt;we found the issue is not related to vite or CSP. it's the similar issue like this one&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/responsetype-image-is-not-supported-in-web-workers/m-p/1018036" target="_blank"&gt;https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/responsetype-image-is-not-supported-in-web-workers/m-p/1018036&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;basically we get the error when `nodeIntegration = true`, turn it off solved the problem. our webpack app works is because we did something like&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;if (process.env.ELECTRON_ENV &amp;amp;&amp;amp; globalThis?.process?.versions?.v8) {
    const process = globalThis.process;
    const versions = process.versions;
    globalThis.process = ({
        ...process,
        versions: {
            ...versions,
            v8: undefined,
        },
        on: process.on,
        emit: process.emit,
    };
}&lt;/LI-CODE&gt;&lt;P&gt;so the host-hode check will return false.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2024 20:15:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapview-invalid-resource-images-on-map-in-electron/m-p/1499346#M84953</guid>
      <dc:creator>JianglinWu</dc:creator>
      <dc:date>2024-06-28T20:15:02Z</dc:date>
    </item>
  </channel>
</rss>

