parallel-webpack icon indicating copy to clipboard operation
parallel-webpack copied to clipboard

Could you support new feature to allow us pass the webpack configuration object directly?

Open tianyingchun opened this issue 5 years ago • 1 comments

Could you support new feature to allow us pass the webpack configuration object directly?

for now

var run = require('parallel-webpack').run,
    configPath = require.resolve('./webpack.config.js');

run(configPath, {
    watch: false,
    maxRetries: 1,
    stats: true, // defaults to false
    maxConcurrentWorkers: 2 // use 2 workers
});

new feature is.

run({ .... webpack configuration here. }, {
    watch: false,
    maxRetries: 1,
    stats: true, // defaults to false
    maxConcurrentWorkers: 2 // use 2 workers
});

tianyingchun avatar Sep 15 '20 05:09 tianyingchun

@tianyingchun you can pass in a file that returns a callback function.

some-file.js
module.exports = () => { /** webpack configuration object /* } ;

then call it with

var run = require('parallel-webpack').run,
    configPath = require.resolve('some-file.js');

run(configPath, {
    watch: false,
    maxRetries: 1,
    stats: true, // defaults to false
    maxConcurrentWorkers: 2 // use 2 workers
});

jlurena avatar Jan 04 '21 21:01 jlurena