Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parallelism not work #2873

Closed
keenwon opened this issue Aug 1, 2021 · 4 comments · Fixed by #2874
Closed

parallelism not work #2873

keenwon opened this issue Aug 1, 2021 · 4 comments · Fixed by #2874

Comments

@keenwon
Copy link

keenwon commented Aug 1, 2021

Bug report

What is the current behavior?

https://webpack.docschina.org/configuration/configuration-types/#parallelism

parallelism does not work

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

index.js

console.log(`test ${Math.random()}`)
console.log(`test ${Math.random()}`)
console.log(`test ${Math.random()}`)
console.log(`test ${Math.random()}`)
console.log(`test ${Math.random()}`)
console.log(`test ${Math.random()}`)

webpack.config.js

const path = require("path")
const SimpleProgressWebpackPlugin = require("simple-progress-webpack-plugin")

const configs = []

for (let i = 0; i < 3; i++) {
  configs.push({
    name: `build${i}`,
    entry: "./index",
    output: {
      path: path.join(__dirname, "dist"),
      filename: `build${i}.js`,
    },
    plugins: [
      new SimpleProgressWebpackPlugin({
        name: `build${i}`,
        format: "simple",
      }),
    ],
  })
}

module.exports = configs
module.exports.parallelism = 1

output:

build0

  ❯ Compile modules
build1

  ❯ Compile modules
build2

  ❯ Compile modules
  ❯ Build modules
  ❯ Build modules
  ❯ Build modules
  ❯ Optimize modules
  ❯ Optimize modules
  ❯ Optimize modules
  ❯ Emit files

Finished after 0.244 seconds.

  ❯ Emit files

Finished after 0.242 seconds.

  ❯ Emit files

Finished after 0.254 seconds.

build0
  ❯ Emit files

Finished after 0.000 seconds.

build1
  ❯ Emit files

Finished after 0.000 seconds.

build2
  ❯ Emit files

Finished after 0.001 seconds.

build0:
  asset build0.js 222 bytes [compared for emit] [minimized] (name: main)
  ./index.js 222 bytes [built] [code generated]

  WARNING in configuration
  The 'mode' option has not been set, webpack will fallback to 'production' for this value.
  Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
  You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/

  build0 (webpack 5.47.1) compiled with 1 warning in 237 ms

build1:
  asset build1.js 222 bytes [compared for emit] [minimized] (name: main)
  ./index.js 222 bytes [built] [code generated]

  WARNING in configuration
  The 'mode' option has not been set, webpack will fallback to 'production' for this value.
  Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
  You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/

  build1 (webpack 5.47.1) compiled with 1 warning in 230 ms

build2:
  asset build2.js 222 bytes [compared for emit] [minimized] (name: main)
  ./index.js 222 bytes [built] [code generated]

  WARNING in configuration
  The 'mode' option has not been set, webpack will fallback to 'production' for this value.
  Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
  You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/

  build2 (webpack 5.47.1) compiled with 1 warning in 215 ms

What is the expected behavior?

Other relevant information:
webpack version: 5.47.1
Node.js version: v14.16.1
Operating System: ubuntu
Additional tools: "webpack-cli": "^4.7.2"

@webpack-bot
Copy link

For maintainers only:

  • webpack-4
  • webpack-5
  • bug
  • critical-bug
  • enhancement
  • documentation
  • performance
  • dependencies
  • question

@alexander-akait
Copy link
Member

alexander-akait commented Aug 2, 2021

Expected, it is not about parallels execution (multi threading) of compilers, it is more about concurrency, name is m slinging due historical reasons, maybe we rename it in future, https://webpack.js.org/configuration/other-options/#parallelism, an issue for multi threading already exists

@sokra sokra reopened this Aug 2, 2021
@sokra
Copy link
Member

sokra commented Aug 2, 2021

It's about concurrency, but that doesn't seem to work, as all compilers execute concurrently which they shouldn't do. I guess that's not correctly passed by webpack-cli

@alexander-akait alexander-akait transferred this issue from webpack/webpack Aug 3, 2021
@alexander-akait
Copy link
Member

WIP on fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants