<?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 jsapi 4.19: Tons of Build Files in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/svelte-jsapi-4-19-tons-of-build-files/m-p/1055274#M72965</link>
    <description>&lt;P&gt;So I took out the copy command (thanks for letting me know on that).&amp;nbsp; However, I still have a ton of files being written to my build folder though.&amp;nbsp; Is that to be expected?&lt;/P&gt;</description>
    <pubDate>Thu, 06 May 2021 16:16:13 GMT</pubDate>
    <dc:creator>LandonPatterson2</dc:creator>
    <dc:date>2021-05-06T16:16:13Z</dc:date>
    <item>
      <title>Svelte jsapi 4.19: Tons of Build Files</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/svelte-jsapi-4-19-tons-of-build-files/m-p/1055230#M72960</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I have been working on building a svelte app with the @arcgis/core. Of course I am using rollup (config below).&amp;nbsp; When I go to build (&lt;SPAN&gt;rollup&amp;nbsp;-c) or dev (&lt;SPAN&gt;rollup&amp;nbsp;-c&amp;nbsp;-w) I get a&amp;nbsp;TON&amp;nbsp;of files written to either the&amp;nbsp;&lt;EM&gt;build&amp;nbsp;or&amp;nbsp;&lt;EM&gt;assets folder.&amp;nbsp; I have tried a few different things to mitigate this as it make dev impossible with over 300 or so files.&amp;nbsp;&lt;/EM&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Is there a way to change my rollup.config.js file so I don't have a 20mb assets or build folder?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;rollup.config.js&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;import svelte from "rollup-plugin-svelte";
import commonjs from "@rollup/plugin-commonjs";
import resolve from "@rollup/plugin-node-resolve";
import del from "rollup-plugin-delete";
import livereload from "rollup-plugin-livereload";
import { terser } from "rollup-plugin-terser";
import css from "rollup-plugin-css-only";

const production = !process.env.ROLLUP_WATCH;

function serve() {
  let server;

  function toExit() {
    if (server) server.kill(0);
  }

  return {
    writeBundle() {
      if (server) return;
      server = require("child_process").spawn(
        "npm",
        ["run", "start", "--", "--dev"],
        {
          stdio: ["ignore", "inherit", "inherit"],
          shell: true,
        }
      );

      process.on("SIGTERM", toExit);
      process.on("exit", toExit);
    },
  };
}

export default {
  input: "src/main.js",
  output: {
    sourcemap: true,
    name: "app",


    dir: "public/build",
    format: "esm",
  },
  plugins: [

    svelte({
      compilerOptions: {
        // enable run-time checks when not in production
        dev: !production,
      },
    }),
    // we'll extract any component CSS out into
    // a separate file - better for performance
    css({ output: "bundle.css" }),

    // If you have external dependencies installed from
    // npm, you'll most likely need these plugins. In
    // some cases you'll need additional configuration -
    // consult the documentation for details:
    // https://github.com/rollup/plugins/tree/master/packages/commonjs
    resolve({
      browser: true,
      dedupe: ["svelte"],
    }),
    commonjs(),

    // In dev mode, call `npm run start` once
    // the bundle has been generated
    !production &amp;amp;&amp;amp; serve(),

    // Watch the `public` directory and refresh the
    // browser on changes when not in production
    !production &amp;amp;&amp;amp; livereload("public"),

    // If we're building for production (npm run build
    // instead of npm run dev), minify
    production &amp;amp;&amp;amp; terser(),
  ],
  watch: {
    clearScreen: false,
  },
  preserveEntrySignatures: false,
};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;package.json&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
  "name": "jsapi-svelte-template",
  "version": "4.19.0",
  "scripts": {
    "build": "npm run copy &amp;amp;&amp;amp; rollup -c",
    "dev": "npm run copy &amp;amp;&amp;amp; rollup -c -w",
    "start": "npm run copy &amp;amp;&amp;amp; sirv public",
    "copy": "ncp ./node_modules/@arcgis/core/assets ./public/assets"
  },
  "devDependencies": {
    "@arcgis/core": "^4.19.0",
    "@rollup/plugin-commonjs": "^16.0.0",
    "@rollup/plugin-node-resolve": "^10.0.0",
    "rollup": "^2.3.4",
    "rollup-plugin-css-only": "^3.1.0",
    "rollup-plugin-delete": "^2.0.0",
    "rollup-plugin-livereload": "^2.0.0",
    "rollup-plugin-svelte": "^7.0.0",
    "rollup-plugin-terser": "^7.0.0",
    "svelte": "^3.0.0"
  },
  "dependencies": {
    "ncp": "^2.0.0",
    "sirv-cli": "^1.0.0"
  }
}&amp;lt;div&amp;gt; &amp;lt;div&amp;gt;&amp;lt;span&amp;gt;main.js&amp;lt;li-code lang="javascript"&amp;gt;import App from "./App.svelte";
import esriConfig from "@arcgis/core/config.js";
esriConfig.assetsPath = "./assets";

const app = new App({
  target: document.body,
});

export default app;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 May 2021 14:39:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/svelte-jsapi-4-19-tons-of-build-files/m-p/1055230#M72960</guid>
      <dc:creator>LandonPatterson2</dc:creator>
      <dc:date>2021-05-06T14:39:04Z</dc:date>
    </item>
    <item>
      <title>Re: Svelte jsapi 4.19: Tons of Build Files</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/svelte-jsapi-4-19-tons-of-build-files/m-p/1055243#M72962</link>
      <description>&lt;P&gt;If you're using 4.19, you don't need to copy the assets anymore, you can remove that script from your package.json.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/release-notes/#assets-for-local-builds" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/release-notes/#assets-for-local-builds&lt;/A&gt;&lt;/P&gt;&lt;P&gt;That will cut down on all those extra files.&lt;/P&gt;</description>
      <pubDate>Thu, 06 May 2021 15:16:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/svelte-jsapi-4-19-tons-of-build-files/m-p/1055243#M72962</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2021-05-06T15:16:20Z</dc:date>
    </item>
    <item>
      <title>Re: Svelte jsapi 4.19: Tons of Build Files</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/svelte-jsapi-4-19-tons-of-build-files/m-p/1055274#M72965</link>
      <description>&lt;P&gt;So I took out the copy command (thanks for letting me know on that).&amp;nbsp; However, I still have a ton of files being written to my build folder though.&amp;nbsp; Is that to be expected?&lt;/P&gt;</description>
      <pubDate>Thu, 06 May 2021 16:16:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/svelte-jsapi-4-19-tons-of-build-files/m-p/1055274#M72965</guid>
      <dc:creator>LandonPatterson2</dc:creator>
      <dc:date>2021-05-06T16:16:13Z</dc:date>
    </item>
    <item>
      <title>Re: Svelte jsapi 4.19: Tons of Build Files</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/svelte-jsapi-4-19-tons-of-build-files/m-p/1055280#M72966</link>
      <description>&lt;P&gt;Yes, you will still get about 300 js files in a built app with rollup. You won't use them all, but because of dynamic module loading and the way rollup chunks files, you get a good amount of them. This because depending on your data, you &lt;EM&gt;could&lt;/EM&gt; use them. This is completely expected. You'd maybe use a dozen or so at runtime.&lt;/P&gt;</description>
      <pubDate>Thu, 06 May 2021 16:29:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/svelte-jsapi-4-19-tons-of-build-files/m-p/1055280#M72966</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2021-05-06T16:29:22Z</dc:date>
    </item>
  </channel>
</rss>

