Issue 1:
Feature request

What is the expected behavior?

The cache.maxGenerations config works in filesystem cache to keep cache files slim.

What is motivation or use case for adding/changing the behavior?

Our project is huge, which generate a huge .cache directory over 800MB, and the cache size keep increasing with the passes of compilation. We run the CI progress in a new docker environment everytime when the project code changed, so we need store the .cache directory in outside storage, huge cache file will slow down the CI progress obviously.

I read the source code and find that filesystem cache always keep the unused items until the maxAge is exceeded, so what i need is to set maxGenerations limit to 1 and remove unused items from cache files everytime.

How should this be implemented in your opinion?

Record the generations in pack content items, read the cache.maxGenerations config and decide to keep or remove unused items in Pack._optimizeUnusedContent.

Are you willing to work on this yourself?

Yes

Issue 2:
Bug report

What is the current behavior?

I need to set the max chunck to only 1 and I can't currently do that. This error has been reported before but nothing was done.

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

1 - Create a Nuxt App using npx create-nuxt-app <project-name> (Choose bootstrap, axios and eslint when asked)

2 - Change your "nuxt.config.js" to match the one below.

3 - npm run build

4 - Verify that is a Webpack Bug

5 - Change maxCount:4

6 - npm run build

7 - Verify that it now worked

obs: The file is located in the root of the project.

nuxt.config.js

import webpack from 'webpack';

export default {
// Target: https://go.nuxtjs.dev/config-target
target: 'static',
ssr: false,

// Global page headers: https://go.nuxtjs.dev/config-head
head: {
title: 'salesforce-query-editor',
htmlAttrs: {
lang: 'en',
},
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: '' },
],
link: [],
script: [],
},

// Global CSS: https://go.nuxtjs.dev/config-css
css: [],

// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
plugins: [],

// Auto import components: https://go.nuxtjs.dev/config-components
components: true,

// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
buildModules: [
// https://go.nuxtjs.dev/eslint
['@nuxtjs/eslint-module', { fix: true, quiet: true }],
],

// Modules: https://go.nuxtjs.dev/config-modules
modules: [
'bootstrap-vue/nuxt',
'@nuxtjs/axios',
],

// Axios module configuration: https://go.nuxtjs.dev/config-axios
axios: {},

// Build Configuration: https://go.nuxtjs.dev/config-build
build: {
extend(config, ctx) {
if (ctx.isDev) {
config.devtool = ctx.isClient ? 'source-map' : 'inline-source-map';
}
},

plugins: [
new webpack.optimize.LimitChunkCountPlugin({
maxChunks: 1
})
],
},

router: {
mode: 'hash',
},
}

What is the expected behavior?

It should output one js file as I specified maxChunk = 1 on the LimitChunkCountPlugin

Other relevant information:

webpack version: 4

Node.js version: v12.13.0

Operating System: Windows

Additional tools: