Too many chunks being generated

Bug report

I’ve recently upgrade to webpack 4 and have been struggling with heap dumps and so forth.

Starting the development server...

[hardsource:0f9c41e9] Writing new cache 0f9c41e9...
[hardsource:0f9c41e9] Tracking node dependencies with: yarn.lock.

<--- Last few GCs --->

[4747:0x2aceb80]   759854 ms: Mark-sweep 1267.4 (1413.7) -> 1267.4 (1414.7) MB, 639.4 / 0.0 ms  allocation failure GC in old space requested
[4747:0x2aceb80]   760570 ms: Mark-sweep 1267.4 (1414.7) -> 1267.4 (1396.7) MB, 715.5 / 0.0 ms  last resort GC in old space requested
[4747:0x2aceb80]   761211 ms: Mark-sweep 1267.4 (1396.7) -> 1267.4 (1382.7) MB, 640.6 / 0.0 ms  last resort GC in old space requested


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x3fdb10a255e9 <JSObject>
    1: fromString(aka fromString) [buffer.js:~320] [pc=0x1c6399d193a1](this=0x1b339ee822d1 <undefined>,string=0x355f8ae9a379 <Very long string[24969540]>,encoding=0x3fdb10a35d91 <String[4]: utf8>)
    2: from [buffer.js:189] [bytecode=0x462ced75e09 offset=14](this=0x24419545d09 <JSFunction Buffer (sfi = 0x3dfb2de1cd61)>,value=0x355f8ae9a379 <Very long string[24969540]>,encodingOrOffset=0x3fdb10a...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: node::Abort() [node]
 2: 0x8d04bc [node]
 3: v8::Utils::ReportOOMFailure(char const*, bool) [node]
 4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [node]
 5: v8::internal::Factory::NewRawTwoByteString(int, v8::internal::PretenureFlag) [node]
 6: v8::internal::String::SlowFlatten(v8::internal::Handle<v8::internal::ConsString>, v8::internal::PretenureFlag) [node]
 7: v8::internal::String::Flatten(v8::internal::Handle<v8::internal::String>, v8::internal::PretenureFlag) [node]
 8: v8::String::WriteUtf8(char*, int, int*, int) const [node]
 9: node::StringBytes::Write(v8::Isolate*, char*, unsigned long, v8::Local<v8::Value>, node::encoding, int*) [node]
10: node::Buffer::New(v8::Isolate*, v8::Local<v8::String>, node::encoding) [node]
11: 0x8efaf4 [node]
12: 0x1c6399e920c7
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I eventually got “up and running” with cross-env NODE_OPTIONS=--max_old_space_size=4096 node scripts/start.js and it showed me that I seem to have a lot of large chunks (about 200, and some being 10MiB). My application is relatively large, but overall payload should only be about 10MiB in total.

What is the current behavior?
As part of my config I have

 optimization: {
    removeAvailableModules: false,
    removeEmptyChunks: false,
    splitChunks: false
  },

I’m resolving from app and packages

resolve: {
    // This allows you to set a fallback for where Webpack should look for modules.
    // We placed these paths second because we want `node_modules` to "win"
    // if there are any conflicts. This matches Node resolution mechanism.
    // https://github.com/facebook/create-react-app/issues/253
    modules: [paths.appSrc, paths.packageSrc, 'node_modules'].concat(
      // It is guaranteed to exist because we tweak it in `env.js`
      process.env.NODE_PATH.split(path.delimiter).filter(Boolean)
    ),

and similarly applying babel 7 to app and packages. react-hot-loader` commented out, but doesn’t make any difference.

{
            test: /\.(js|jsx|tsx|ts)?$/,
            include: [
              paths.appSrc,
              paths.packageSrc
            ],
            exclude: /node_modules/,
            use: [
              // This loader parallelizes code compilation, it is optional but
              // improves compile time on larger projects
              {
                loader: require.resolve('thread-loader'),
                options: {
                  poolTimeout: Infinity // keep workers alive for more effective watch mode
                }
              },
              {
                loader: require.resolve('babel-loader'),
                options: {
                  cacheDirectory: true,
                  babelrc: false,
                  presets: [
                    [
                      '@babel/preset-env',
                      { targets: { browsers: 'last 2 versions' } } // or whatever your project requires
                    ],
                    '@babel/preset-typescript',
                    ['@babel/preset-react', { useBuiltIns: true }]
                  ],
                  plugins: [
                    ['@babel/plugin-proposal-decorators', { legacy: true }],
                    ['@babel/plugin-proposal-class-properties', { loose: true }],
                    'babel-plugin-macros',
                    ['@babel/proposal-object-rest-spread', { useBuiltIns: true }],
                    ['@babel/plugin-transform-runtime', { helpers: false, regenerator: true }],
                    ['babel-plugin-transform-react-remove-prop-types', { removeImport: true }],
                    ['@babel/plugin-transform-regenerator', { async: false }],
                    '@babel/plugin-transform-destructuring',
                    '@babel/plugin-syntax-dynamic-import'
                    //'react-hot-loader/babel'
                  ]
                }
              }
            ]
          },

And here is the output…

Version: webpack 4.8.3
Time: 57148ms
Built at: 09/20/2018 2:35:01 PM
                                                    Asset       Size  Chunks                    Chunk Names
                                    static/js/91.chunk.js    930 KiB      91  [emitted]  [big]
   static/media/glyphicons-halflings-regular.f4769f9b.eot   19.7 KiB          [emitted]
   static/media/glyphicons-halflings-regular.e18bbf61.ttf   44.3 KiB          [emitted]
  static/media/glyphicons-halflings-regular.fa277232.woff   22.9 KiB          [emitted]
 static/media/glyphicons-halflings-regular.448c34a5.woff2   17.6 KiB          [emitted]
                        static/media/dialog.8652bed9.jade   1.65 KiB          [emitted]
                          static/media/list.4d113733.jade   1.21 KiB          [emitted]
                        static/media/dialog.90c36d82.jade   2.23 KiB          [emitted]
                          static/media/list.e9a0da4f.jade   1.68 KiB          [emitted]
                        static/media/dialog.ba3df2f3.jade   2.37 KiB          [emitted]
                     static/media/file-item.bb697cb5.jade  171 bytes          [emitted]
                          static/media/list.70ee9ea5.jade  573 bytes          [emitted]
                        static/media/dialog.754e5f9e.jade   1.63 KiB          [emitted]
                          static/media/list.bc9ef8b3.jade   1.63 KiB          [emitted]
 static/media/architects-daughter-latin-400.0891b802.woff   15.1 KiB          [emitted]
static/media/architects-daughter-latin-400.82fade6a.woff2   12.7 KiB          [emitted]
              static/media/roboto-latin-100.e9dbbe8a.woff   19.5 KiB          [emitted]
             static/media/roboto-latin-100.987b8457.woff2     15 KiB          [emitted]
        static/media/roboto-latin-100italic.d704bb3d.woff   20.8 KiB          [emitted]
       static/media/roboto-latin-100italic.6232f43d.woff2   16.3 KiB          [emitted]
              static/media/roboto-latin-300.a1471d1d.woff   19.4 KiB          [emitted]
             static/media/roboto-latin-300.55536c8e.woff2   15.1 KiB          [emitted]
        static/media/roboto-latin-300italic.210a7c78.woff   21.3 KiB          [emitted]
       static/media/roboto-latin-300italic.d69924b9.woff2   16.7 KiB          [emitted]
              static/media/roboto-latin-400.bafb105b.woff   19.4 KiB          [emitted]
             static/media/roboto-latin-400.5d4aeb4e.woff2     15 KiB          [emitted]
        static/media/roboto-latin-400italic.9680d5a0.woff     21 KiB          [emitted]
       static/media/roboto-latin-400italic.d8bcbe72.woff2   16.5 KiB          [emitted]
              static/media/roboto-latin-500.de8b7431.woff   19.5 KiB          [emitted]
             static/media/roboto-latin-500.28546717.woff2   15.2 KiB          [emitted]
        static/media/roboto-latin-500italic.ffcc050b.woff   21.1 KiB          [emitted]
       static/media/roboto-latin-500italic.510dec37.woff2   16.5 KiB          [emitted]
              static/media/roboto-latin-700.cf6613d1.woff   19.4 KiB          [emitted]
             static/media/roboto-latin-700.037d8304.woff2   15.1 KiB          [emitted]
        static/media/roboto-latin-700italic.846d1890.woff   20.6 KiB          [emitted]
       static/media/roboto-latin-700italic.010c1aee.woff2   16.2 KiB          [emitted]
              static/media/roboto-latin-900.8c2ade50.woff   19.5 KiB          [emitted]
             static/media/roboto-latin-900.19b7a0ad.woff2     15 KiB          [emitted]
        static/media/roboto-latin-900italic.bc833e72.woff   21.3 KiB          [emitted]
       static/media/roboto-latin-900italic.7b770d6c.woff2   16.8 KiB          [emitted]
                          static/media/yarn.7ace2ff6.lock    132 KiB          [emitted]
                                   static/js/111.chunk.js   18.6 KiB     111  [emitted]
                                      static/js/bundle.js   16.6 MiB    main  [emitted]  [big]  main
                                     static/js/1.chunk.js   3.73 MiB       1  [emitted]  [big]
                                     static/js/2.chunk.js    9.9 MiB       2  [emitted]  [big]
                                     static/js/3.chunk.js   10.9 MiB       3  [emitted]  [big]
                                     static/js/4.chunk.js    9.7 MiB       4  [emitted]  [big]
                                     static/js/5.chunk.js    9.7 MiB       5  [emitted]  [big]
                                     static/js/6.chunk.js   9.71 MiB       6  [emitted]  [big]
                                     static/js/7.chunk.js   3.27 MiB       7  [emitted]  [big]
                                     static/js/8.chunk.js   9.73 MiB       8  [emitted]  [big]
                                     static/js/9.chunk.js   9.83 MiB       9  [emitted]  [big]
                                    static/js/10.chunk.js    9.7 MiB      10  [emitted]  [big]
                                    static/js/11.chunk.js     10 MiB      11  [emitted]  [big]
                                    static/js/12.chunk.js   9.88 MiB      12  [emitted]  [big]
                                    static/js/13.chunk.js   9.73 MiB      13  [emitted]  [big]
                                    static/js/14.chunk.js    9.7 MiB      14  [emitted]  [big]
                                    static/js/15.chunk.js   18.3 KiB      15  [emitted]
                                    static/js/16.chunk.js   9.71 MiB      16  [emitted]  [big]
                                    static/js/17.chunk.js   18.6 KiB      17  [emitted]
                                    static/js/18.chunk.js   1.04 MiB      18  [emitted]  [big]
                                    static/js/19.chunk.js    931 KiB      19  [emitted]  [big]
                                    static/js/20.chunk.js   2.09 MiB      20  [emitted]  [big]
                                    static/js/21.chunk.js    931 KiB      21  [emitted]  [big]
                                    static/js/22.chunk.js   2.09 MiB      22  [emitted]  [big]
                                    static/js/23.chunk.js    930 KiB      23  [emitted]  [big]
                                    static/js/24.chunk.js   9.77 MiB      24  [emitted]  [big]
                                    static/js/25.chunk.js   9.81 MiB      25  [emitted]  [big]
                                    static/js/26.chunk.js   9.72 MiB      26  [emitted]  [big]
                                    static/js/27.chunk.js   18.2 KiB      27  [emitted]
                                    static/js/28.chunk.js   9.75 MiB      28  [emitted]  [big]
                                    static/js/29.chunk.js   9.73 MiB      29  [emitted]  [big]
                                    static/js/30.chunk.js   9.72 MiB      30  [emitted]  [big]
                                    static/js/31.chunk.js   9.73 MiB      31  [emitted]  [big]
                                    static/js/32.chunk.js   18.2 KiB      32  [emitted]
                                    static/js/33.chunk.js   9.72 MiB      33  [emitted]  [big]
                                    static/js/34.chunk.js   9.71 MiB      34  [emitted]  [big]
                                    static/js/35.chunk.js   18.4 KiB      35  [emitted]
                                    static/js/36.chunk.js    298 KiB      36  [emitted]  [big]
                                    static/js/37.chunk.js   1.38 KiB      37  [emitted]
                                    static/js/38.chunk.js    9.7 MiB      38  [emitted]  [big]
                                    static/js/39.chunk.js    930 KiB      39  [emitted]  [big]
                                    static/js/40.chunk.js    930 KiB      40  [emitted]  [big]
                                    static/js/41.chunk.js    930 KiB      41  [emitted]  [big]
                                    static/js/42.chunk.js    930 KiB      42  [emitted]  [big]
                                    static/js/43.chunk.js   9.81 MiB      43  [emitted]  [big]
                                    static/js/44.chunk.js    9.7 MiB      44  [emitted]  [big]
                                    static/js/45.chunk.js   9.73 MiB      45  [emitted]  [big]
                                    static/js/46.chunk.js     10 MiB      46  [emitted]  [big]
                                    static/js/47.chunk.js   2.12 MiB      47  [emitted]  [big]
                                    static/js/48.chunk.js   1.46 MiB      48  [emitted]  [big]
                                    static/js/49.chunk.js   18.8 KiB      49  [emitted]
                                    static/js/50.chunk.js  438 bytes      50  [emitted]
                                    static/js/51.chunk.js   2.09 MiB      51  [emitted]  [big]
                                    static/js/52.chunk.js    930 KiB      52  [emitted]  [big]
                                    static/js/53.chunk.js   1.04 MiB      53  [emitted]  [big]
                                    static/js/54.chunk.js    2.1 MiB      54  [emitted]  [big]
                                    static/js/55.chunk.js   9.81 MiB      55  [emitted]  [big]
                                    static/js/56.chunk.js   9.78 MiB      56  [emitted]  [big]
                                    static/js/57.chunk.js     10 MiB      57  [emitted]  [big]
                                    static/js/58.chunk.js   2.12 MiB      58  [emitted]  [big]
                                    static/js/59.chunk.js    428 KiB      59  [emitted]  [big]
                                    static/js/60.chunk.js   18.9 KiB      60  [emitted]
                                    static/js/61.chunk.js    930 KiB      61  [emitted]  [big]
                                    static/js/62.chunk.js    930 KiB      62  [emitted]  [big]
                                    static/js/63.chunk.js    9.8 MiB      63  [emitted]  [big]
                                    static/js/64.chunk.js   9.78 MiB      64  [emitted]  [big]
                                    static/js/65.chunk.js   9.99 MiB      65  [emitted]  [big]
                                    static/js/66.chunk.js   2.12 MiB      66  [emitted]  [big]
                                    static/js/67.chunk.js    429 KiB      67  [emitted]  [big]
                                    static/js/68.chunk.js   18.8 KiB      68  [emitted]
                                    static/js/69.chunk.js   18.5 KiB      69  [emitted]
                                    static/js/70.chunk.js   9.73 MiB      70  [emitted]  [big]
                                    static/js/71.chunk.js   18.8 KiB      71  [emitted]
                                    static/js/72.chunk.js    9.8 MiB      72  [emitted]  [big]
                                    static/js/73.chunk.js   9.78 MiB      73  [emitted]  [big]
                                    static/js/74.chunk.js   9.98 MiB      74  [emitted]  [big]
                                    static/js/75.chunk.js   2.12 MiB      75  [emitted]  [big]
                                    static/js/76.chunk.js    429 KiB      76  [emitted]  [big]
                                    static/js/77.chunk.js   18.9 KiB      77  [emitted]
                                    static/js/78.chunk.js   9.79 MiB      78  [emitted]  [big]
                                    static/js/79.chunk.js   9.78 MiB      79  [emitted]  [big]
                                    static/js/80.chunk.js   9.97 MiB      80  [emitted]  [big]
                                    static/js/81.chunk.js   2.12 MiB      81  [emitted]  [big]
                                    static/js/82.chunk.js    428 KiB      82  [emitted]  [big]
                                    static/js/83.chunk.js   18.9 KiB      83  [emitted]
                                    static/js/84.chunk.js   9.79 MiB      84  [emitted]  [big]
                                    static/js/85.chunk.js   9.78 MiB      85  [emitted]  [big]
                                    static/js/86.chunk.js   9.97 MiB      86  [emitted]  [big]
                                    static/js/87.chunk.js   2.12 MiB      87  [emitted]  [big]
                                    static/js/88.chunk.js    428 KiB      88  [emitted]  [big]
                                    static/js/89.chunk.js   18.9 KiB      89  [emitted]
                                    static/js/90.chunk.js    930 KiB      90  [emitted]  [big]
   static/media/glyphicons-halflings-regular.89889688.svg    106 KiB          [emitted]
                                    static/js/92.chunk.js   9.81 MiB      92  [emitted]  [big]
                                    static/js/93.chunk.js   9.78 MiB      93  [emitted]  [big]
                                    static/js/94.chunk.js   9.99 MiB      94  [emitted]  [big]
                                    static/js/95.chunk.js   2.12 MiB      95  [emitted]  [big]
                                    static/js/96.chunk.js    428 KiB      96  [emitted]  [big]
                                    static/js/97.chunk.js   18.9 KiB      97  [emitted]
                                    static/js/98.chunk.js   9.79 MiB      98  [emitted]  [big]
                                    static/js/99.chunk.js   9.78 MiB      99  [emitted]  [big]
                                   static/js/100.chunk.js   9.98 MiB     100  [emitted]  [big]
                                   static/js/101.chunk.js   2.12 MiB     101  [emitted]  [big]
                                   static/js/102.chunk.js    429 KiB     102  [emitted]  [big]
                                   static/js/103.chunk.js   18.9 KiB     103  [emitted]
                                   static/js/104.chunk.js    930 KiB     104  [emitted]  [big]
                                   static/js/105.chunk.js    9.8 MiB     105  [emitted]  [big]
                                   static/js/106.chunk.js   9.79 MiB     106  [emitted]  [big]
                                   static/js/107.chunk.js     10 MiB     107  [emitted]  [big]
                                   static/js/108.chunk.js   2.12 MiB     108  [emitted]  [big]
                                   static/js/109.chunk.js    428 KiB     109  [emitted]  [big]
                                   static/js/110.chunk.js   18.9 KiB     110  [emitted]
                                     static/js/0.chunk.js   10.7 MiB       0  [emitted]  [big]
                                   static/js/112.chunk.js    930 KiB     112  [emitted]  [big]
                                   static/js/113.chunk.js    931 KiB     113  [emitted]  [big]
                                   static/js/114.chunk.js    931 KiB     114  [emitted]  [big]
                                   static/js/115.chunk.js    931 KiB     115  [emitted]  [big]
                                   static/js/116.chunk.js    930 KiB     116  [emitted]  [big]
                                   static/js/117.chunk.js    931 KiB     117  [emitted]  [big]
                                   static/js/118.chunk.js    930 KiB     118  [emitted]  [big]
                                   static/js/119.chunk.js    930 KiB     119  [emitted]  [big]
                                   static/js/120.chunk.js   9.84 MiB     120  [emitted]  [big]
                                   static/js/121.chunk.js   9.78 MiB     121  [emitted]  [big]
                                   static/js/122.chunk.js     10 MiB     122  [emitted]  [big]
                                   static/js/123.chunk.js   2.12 MiB     123  [emitted]  [big]
                                   static/js/124.chunk.js    430 KiB     124  [emitted]  [big]
                                   static/js/125.chunk.js   18.9 KiB     125  [emitted]
                                   static/js/126.chunk.js   2.09 MiB     126  [emitted]  [big]
                                   static/js/127.chunk.js    9.8 MiB     127  [emitted]  [big]
                                   static/js/128.chunk.js   9.78 MiB     128  [emitted]  [big]
                                   static/js/129.chunk.js   9.98 MiB     129  [emitted]  [big]
                                   static/js/130.chunk.js   2.13 MiB     130  [emitted]  [big]
                                   static/js/131.chunk.js    428 KiB     131  [emitted]  [big]
                                   static/js/132.chunk.js     19 KiB     132  [emitted]
                                   static/js/133.chunk.js   18.5 KiB     133  [emitted]
                                   static/js/134.chunk.js    930 KiB     134  [emitted]  [big]
                                   static/js/135.chunk.js    931 KiB     135  [emitted]  [big]
                                   static/js/136.chunk.js    931 KiB     136  [emitted]  [big]
                                   static/js/137.chunk.js    9.8 MiB     137  [emitted]  [big]
                                   static/js/138.chunk.js   9.72 MiB     138  [emitted]  [big]
                                   static/js/139.chunk.js   9.99 MiB     139  [emitted]  [big]
                                   static/js/140.chunk.js   2.12 MiB     140  [emitted]  [big]
                                   static/js/141.chunk.js    428 KiB     141  [emitted]  [big]
                                   static/js/142.chunk.js   18.8 KiB     142  [emitted]
                                   static/js/143.chunk.js    931 KiB     143  [emitted]  [big]
                                   static/js/144.chunk.js    931 KiB     144  [emitted]  [big]
                                   static/js/145.chunk.js    930 KiB     145  [emitted]  [big]
                                   static/js/146.chunk.js   9.81 MiB     146  [emitted]  [big]
                                   static/js/147.chunk.js   9.72 MiB     147  [emitted]  [big]
                                   static/js/148.chunk.js     10 MiB     148  [emitted]  [big]
                                   static/js/149.chunk.js   2.12 MiB     149  [emitted]  [big]
                                   static/js/150.chunk.js    429 KiB     150  [emitted]  [big]
                                   static/js/151.chunk.js     19 KiB     151  [emitted]
                                   static/js/152.chunk.js    931 KiB     152  [emitted]  [big]
                                   static/js/153.chunk.js    931 KiB     153  [emitted]  [big]
                                   static/js/154.chunk.js    9.8 MiB     154  [emitted]  [big]
                                   static/js/155.chunk.js   9.72 MiB     155  [emitted]  [big]
                                   static/js/156.chunk.js   9.98 MiB     156  [emitted]  [big]
                                   static/js/157.chunk.js   2.12 MiB     157  [emitted]  [big]
                                   static/js/158.chunk.js    428 KiB     158  [emitted]  [big]
                                   static/js/159.chunk.js   18.9 KiB     159  [emitted]
                                   static/js/160.chunk.js    931 KiB     160  [emitted]  [big]
                                   static/js/161.chunk.js    931 KiB     161  [emitted]  [big]
                                   static/js/162.chunk.js    9.8 MiB     162  [emitted]  [big]
                                   static/js/163.chunk.js    9.8 MiB     163  [emitted]  [big]
                                   static/js/164.chunk.js     10 MiB     164  [emitted]  [big]
                                   static/js/165.chunk.js   2.12 MiB     165  [emitted]  [big]
                                   static/js/166.chunk.js    428 KiB     166  [emitted]  [big]
                                   static/js/167.chunk.js   18.9 KiB     167  [emitted]
                                   static/js/168.chunk.js   9.78 MiB     168  [emitted]  [big]
                                   static/js/169.chunk.js   9.72 MiB     169  [emitted]  [big]
                                   static/js/170.chunk.js   9.96 MiB     170  [emitted]  [big]
                                   static/js/171.chunk.js   2.12 MiB     171  [emitted]  [big]
                                   static/js/172.chunk.js    428 KiB     172  [emitted]  [big]
                                   static/js/173.chunk.js   18.9 KiB     173  [emitted]
                                   static/js/174.chunk.js   9.78 MiB     174  [emitted]  [big]
                                   static/js/175.chunk.js   9.71 MiB     175  [emitted]  [big]
                                   static/js/176.chunk.js   9.96 MiB     176  [emitted]  [big]
                                   static/js/177.chunk.js   2.12 MiB     177  [emitted]  [big]
                                   static/js/178.chunk.js    428 KiB     178  [emitted]  [big]
                                   static/js/179.chunk.js     19 KiB     179  [emitted]
                                   static/js/180.chunk.js    931 KiB     180  [emitted]  [big]
                                   static/js/181.chunk.js    931 KiB     181  [emitted]  [big]
                                   static/js/182.chunk.js    9.8 MiB     182  [emitted]  [big]
                                   static/js/183.chunk.js   9.72 MiB     183  [emitted]  [big]
                                   static/js/184.chunk.js   9.99 MiB     184  [emitted]  [big]
                                   static/js/185.chunk.js   2.12 MiB     185  [emitted]  [big]
                                   static/js/186.chunk.js    428 KiB     186  [emitted]  [big]
                                   static/js/187.chunk.js   18.9 KiB     187  [emitted]
                                   static/js/188.chunk.js    931 KiB     188  [emitted]  [big]
                                   static/js/189.chunk.js    931 KiB     189  [emitted]  [big]
                                   static/js/190.chunk.js    9.8 MiB     190  [emitted]  [big]
                                   static/js/191.chunk.js   9.72 MiB     191  [emitted]  [big]
                                   static/js/192.chunk.js   9.99 MiB     192  [emitted]  [big]
                                   static/js/193.chunk.js   2.12 MiB     193  [emitted]  [big]
                                   static/js/194.chunk.js    428 KiB     194  [emitted]  [big]
                                   static/js/195.chunk.js     19 KiB     195  [emitted]
                                   static/js/196.chunk.js    931 KiB     196  [emitted]  [big]
                                   static/js/197.chunk.js    931 KiB     197  [emitted]  [big]
                                   static/js/198.chunk.js    9.8 MiB     198  [emitted]  [big]
                                   static/js/199.chunk.js   9.78 MiB     199  [emitted]  [big]
                                   static/js/200.chunk.js   9.98 MiB     200  [emitted]  [big]
                                   static/js/201.chunk.js   2.12 MiB     201  [emitted]  [big]
                                   static/js/202.chunk.js    428 KiB     202  [emitted]  [big]
                                   static/js/203.chunk.js   18.8 KiB     203  [emitted]
                                   static/js/204.chunk.js    931 KiB     204  [emitted]  [big]
                                   static/js/205.chunk.js   9.79 MiB     205  [emitted]  [big]
                                   static/js/206.chunk.js   9.78 MiB     206  [emitted]  [big]
                                   static/js/207.chunk.js   9.98 MiB     207  [emitted]  [big]
                                   static/js/208.chunk.js   2.12 MiB     208  [emitted]  [big]
                                   static/js/209.chunk.js    428 KiB     209  [emitted]  [big]
                                   static/js/210.chunk.js   18.8 KiB     210  [emitted]
                                   static/js/211.chunk.js   18.6 KiB     211  [emitted]
                                   static/js/212.chunk.js   9.72 MiB     212  [emitted]  [big]
                                   static/js/213.chunk.js     23 KiB     213  [emitted]
                                   static/js/214.chunk.js    588 KiB     214  [emitted]  [big]
                                   static/js/215.chunk.js   1.55 MiB     215  [emitted]  [big]
                                   static/js/216.chunk.js    823 KiB     216  [emitted]  [big]
                                   static/js/217.chunk.js    2.1 MiB     217  [emitted]  [big]
                                   static/js/218.chunk.js   2.06 MiB     218  [emitted]  [big]
                                   static/js/219.chunk.js    9.7 MiB     219  [emitted]  [big]
                                   static/js/220.chunk.js   1.45 MiB     220  [emitted]  [big]
                                   static/js/221.chunk.js    295 KiB     221  [emitted]  [big]
                                   static/js/222.chunk.js  338 bytes     222  [emitted]
                                               index.html   2.02 KiB          [emitted]
                                      asset-manifest.json   15.1 KiB          [emitted]
Entrypoint main [big] = static/js/bundle.js
[./app/app.tsx] 1.88 KiB {main} [built]
[./app/initialise.js] 6.72 KiB {main} [built]
[./app/styles/bz-controls.styl] 1.18 KiB {main} [built]
[./config/polyfills.js] 858 bytes {main} [built]
[./node_modules/react-dev-utils/launchEditorEndpoint.js] 329 bytes {main} [built]
[./node_modules/react-dev-utils/node_modules/react-error-overlay/lib/index.js] 312 KiB {main} [built]
[./node_modules/react-dev-utils/webpackHotDevClient.js] 7.69 KiB {main} [built]
[./node_modules/react-dom/index.js] 58 bytes {main} {0} {1} {2} {3} {4} {5} {6} {7} {8} {9} {10} {11} {12} {13} {14} {16} {18} {19} {20} {21} {22} {23} {24} {25} {26} {28} {29} {30} {31} {33} {34} {38} {39} {40} {41} {42} {43} {44} {45} {46} {47} {51} {52} {53} {54} {55} {56} {57} {58} {61} {62} {63} {64} {65} {66} {70} {72} {73} {74} {75} {78} {79} {80} {81} {84} {85} {86} {87} {90} {91} {92} {93} {94} {95} {98} {99} {100} {101} {104} {105} {106} {107} {108} {112} {113} {114} {115} {116} {117} {118} {119} {120} {121} {122} {123} {126} {127} {128} {129} {130} {134} {135} {136} {137} {138} {139} {140} {143} {144} {145} {146} {147} {148} {149} {152} {153} {154} {155} {156} {157} {160} {161} {162} {163} {164} {165} {168} {169} {170} {171} {174} {175} {176} {177} {180} {181} {182} {183} {184} {185} {188} {189} {190} {191} {192} {193} {196} {197} {198} {199} {200} {201} {204} {205} {206} {207} {208} {212} {217} {218} {219} [built]
[./node_modules/react-hot-loader/index.js] 228 bytes {main} [built]
[./node_modules/react/react.js] 55 bytes {main} {0} {1} {2} {3} {4} {5} {6} {7} {8} {9} {10} {11} {12} {13} {14} {16} {18} {19} {20} {21} {22} {23} {24} {25} {26} {28} {29} {30} {31} {33} {34} {36} {38} {39} {40} {41} {42} {43} {44} {45} {46} {47} {48} {51} {52} {53} {54} {55} {56} {57} {58} {59} {61} {62} {63} {64} {65} {66} {67} {70} {72} {73} {74} {75} {76} {78} {79} {80} {81} {82} {84} {85} {86} {87} {88} {90} {91} {92} {93} {94} {95} {96} {98} {99} {100} {101} {102} {104} {105} {106} {107} {108} {109} {112} {113} {114} {115} {116} {117} {118} {119} {120} {121} {122} {123} {124} {126} {127} {128} {129} {130} {131} {134} {135} {136} {137} {138} {139} {140} {141} {143} {144} {145} {146} {147} {148} {149} {150} {152} {153} {154} {155} {156} {157} {158} {160} {161} {162} {163} {164} {165} {166} {168} {169} {170} {171} {172} {174} {175} {176} {177} {178} {180} {181} {182} {183} {184} {185} {186} {188} {189} {190} {191} {192} {193} {194} {196} {197} {198} {199} {200} {201} {202} {204} {205} {206} {207} {208} {209} {212} {214} {217} {218} {219} {220} {221} [built]
[./node_modules/url/url.js] 22.2 KiB {main} [built]
[./node_modules/validate.js/validate.js] 34.5 KiB {main} {0} {2} {3} {4} {5} {6} {8} {9} {10} {11} {12} {13} {14} {16} {24} {25} {26} {28} {29} {30} {31} {33} {34} {38} {43} {44} {45} {46} {55} {56} {57} {63} {64} {65} {70} {72} {73} {74} {78} {79} {80} {84} {85} {86} {92} {93} {94} {98} {99} {100} {105} {106} {107} {120} {121} {122} {127} {128} {129} {137} {138} {139} {146} {147} {148} {154} {155} {156} {162} {163} {164} {168} {169} {170} {174} {175} {176} {182} {183} {184} {190} {191} {192} {198} {199} {200} {205} {206} {207} {212} {219} [built]
[0] multi ./config/polyfills.js ./node_modules/react-dev-utils/webpackHotDevClient.js ./app/initialise.js 52 bytes {main} [built]
[./node_modules/whatwg-fetch/fetch.js] 13 KiB {main} [built]
[./packages/react-kendo/lib/index.js] 587 bytes {main} {0} {12} {20} {22} {24} {25} {28} {43} {46} {47} {51} {54} {55} {56} {57} {58} {63} {64} {65} {66} {72} {73} {74} {75} {78} {79} {80} {81} {84} {85} {86} {87} {92} {93} {94} {95} {98} {99} {100} {101} {105} {106} {107} {108} {120} {121} {122} {123} {126} {127} {128} {129} {130} {137} {139} {140} {146} {148} {149} {154} {156} {157} {162} {163} {164} {165} {168} {170} {171} {174} {176} {177} {182} {184} {185} {190} {192} {193} {198} {199} {200} {201} {205} {206} {207} {208} {217} {218} [built]
    + 3495 hidden modules

WARNING in ./node_modules/handlebars/lib/index.js
require.extensions is not supported by webpack. Use a loader instead.
 @ ./app/modules/communications/sms/sms-dialog.js 18:41-62
 @ ./app/modules/dashboard/index.tsx
 @ ./app/top-level-app-routes.tsx
 @ ./app/shell/app.tsx
 @ ./app/app.tsx
 @ ./app/initialise.js
 @ multi ./config/polyfills.js ./node_modules/react-dev-utils/webpackHotDevClient.js ./app/initialise.js

WARNING in ./node_modules/handlebars/lib/index.js
require.extensions is not supported by webpack. Use a loader instead.
 @ ./app/modules/communications/sms/sms-dialog.js 18:41-62
 @ ./app/modules/dashboard/index.tsx
 @ ./app/top-level-app-routes.tsx
 @ ./app/shell/app.tsx
 @ ./app/app.tsx
 @ ./app/initialise.js
 @ multi ./config/polyfills.js ./node_modules/react-dev-utils/webpackHotDevClient.js ./app/initialise.js

WARNING in ./node_modules/handlebars/lib/index.js
require.extensions is not supported by webpack. Use a loader instead.
 @ ./app/modules/communications/sms/sms-dialog.js 18:41-62
 @ ./app/modules/dashboard/index.tsx
 @ ./app/top-level-app-routes.tsx
 @ ./app/shell/app.tsx
 @ ./app/app.tsx
 @ ./app/initialise.js
 @ multi ./config/polyfills.js ./node_modules/react-dev-utils/webpackHotDevClient.js ./app/initialise.js
Child html-webpack-plugin for "index.html":
         Asset     Size  Chunks  Chunk Names
    index.html  575 KiB       0
    Entrypoint undefined = index.html
    [./node_modules/html-webpack-plugin/lib/loader.js!./public/index.html] 2.22 KiB {0} [built]
    [./node_modules/lodash/lodash.js] 527 KiB {0} [built]
    [./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js 492 bytes {0} [built]
    [./node_modules/webpack/buildin/module.js] (webpack)/buildin/module.js 546 bytes {0} [built]
i 「wdm」: Compiled with warnings.

If the current behavior is a bug, please provide the steps to reproduce.

What is the expected behavior?
I’d expect 10 to 15 chunks, and the running node process not to require > 2GB memory.

I know this isn’t a mega-helpful bug report yet. I think I need something of a steer on how to investigate these extra chunks further. My working assumption is that they are the problem.

Other relevant information:
webpack version: 4.8.3
Node.js version: 10 (have tried 8.11 and 8.12 too)
Operating System: Windows 10 and Ubuntu 18
Additional tools: –

Author: Fantashit

1 thought on “Too many chunks being generated

  1. I fixed it like this:/

    environment.config.optimization = {
      splitChunks: {
        chunks: 'all',
        cacheGroups: {
          default: false,
          vendors: false
        }
      }
    }
    
    

Comments are closed.