<?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: Too many bundle files generated when building with Webpack in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/too-many-bundle-files-generated-when-building-with/m-p/1153863#M76662</link>
    <description>&lt;P&gt;This is expected behavior. The API takes advantage of dynamic import loading, especially when working with Portal items such as WebMap contents. The number of bundled files can vary from 200-300 depending on your tooling.&lt;/P&gt;&lt;P&gt;You can see a chart here of build metrics for various ESM samples we have.&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/Esri/jsapi-resources/blob/master/esm-samples/.metrics/4.22.2.csv" target="_blank"&gt;https://github.com/Esri/jsapi-resources/blob/master/esm-samples/.metrics/4.22.2.csv&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 15 Mar 2022 15:43:21 GMT</pubDate>
    <dc:creator>ReneRubalcava</dc:creator>
    <dc:date>2022-03-15T15:43:21Z</dc:date>
    <item>
      <title>Too many bundle files generated when building with Webpack</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/too-many-bundle-files-generated-when-building-with/m-p/1153735#M76657</link>
      <description>&lt;P&gt;Hello, I am using webpack to bundle my map application that uses ArcGIS API for JS 4.22.&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the output, many bundle files are created from&amp;nbsp;@arcgis/core. (They are mixed with my other bundle.js files. And I have multiple entry points.)&lt;/P&gt;&lt;P&gt;It looks a bit messy, is there a way to let webpack generate these bundle files into a sub-folder of my JS folder?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Webpack version: 5.69.1 (&lt;STRONG&gt;I am not using arcgis-webpack-plugin.. Should I use it?&lt;/STRONG&gt;)&lt;/P&gt;&lt;P&gt;File structure of the dist folder:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Dist folder structure" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/36355i6EC893E910D56ADA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="image.png" alt="Dist folder structure" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Dist folder structure&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Generated bundle files:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="YingwenDeng_0-1647340546866.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/36358iB76B4C64C9D1CFE6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="YingwenDeng_0-1647340546866.png" alt="YingwenDeng_0-1647340546866.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="YingwenDeng_2-1647341063903.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/36364iF2A23205549ACC8D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="YingwenDeng_2-1647341063903.png" alt="YingwenDeng_2-1647341063903.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;My &lt;STRONG&gt;webpack.prod.js&lt;/STRONG&gt; file:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const path = require('path');
const common = require('./webpack.common');
const {merge} = require('webpack-merge');
// minimize css for prod mode
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin')

module.exports = merge(common, {
    mode: "production",
    devtool: false,
    output: {
        filename: 'js/[name].[contenthash].bundle.js',
        path: path.resolve(__dirname, 'dist'),
        publicPath:"",
        clean: true,
        assetModuleFilename: 'images/[name][ext][query]'
    },
    module: {
        rules: [
            {
            test: /\.css$/,
            use: [MiniCssExtractPlugin.loader, 'css-loader']
        }
        ]
    },
    optimization: {
        minimizer : [
            new CssMinimizerPlugin(),
        ]

    },
    plugins: [
        new MiniCssExtractPlugin({
            filename: "[name].[contenthash].css"
        })
    ]
})&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Mar 2022 10:49:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/too-many-bundle-files-generated-when-building-with/m-p/1153735#M76657</guid>
      <dc:creator>YingwenDeng</dc:creator>
      <dc:date>2022-03-15T10:49:48Z</dc:date>
    </item>
    <item>
      <title>Re: Too many bundle files generated when building with Webpack</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/too-many-bundle-files-generated-when-building-with/m-p/1153863#M76662</link>
      <description>&lt;P&gt;This is expected behavior. The API takes advantage of dynamic import loading, especially when working with Portal items such as WebMap contents. The number of bundled files can vary from 200-300 depending on your tooling.&lt;/P&gt;&lt;P&gt;You can see a chart here of build metrics for various ESM samples we have.&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/Esri/jsapi-resources/blob/master/esm-samples/.metrics/4.22.2.csv" target="_blank"&gt;https://github.com/Esri/jsapi-resources/blob/master/esm-samples/.metrics/4.22.2.csv&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Mar 2022 15:43:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/too-many-bundle-files-generated-when-building-with/m-p/1153863#M76662</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2022-03-15T15:43:21Z</dc:date>
    </item>
    <item>
      <title>Re: Too many bundle files generated when building with Webpack</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/too-many-bundle-files-generated-when-building-with/m-p/1154287#M76675</link>
      <description>&lt;P&gt;Thank you!! The webpack sample is really helpful.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Mar 2022 14:42:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/too-many-bundle-files-generated-when-building-with/m-p/1154287#M76675</guid>
      <dc:creator>YingwenDeng</dc:creator>
      <dc:date>2022-03-16T14:42:26Z</dc:date>
    </item>
  </channel>
</rss>

