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

Support Multiple Configs [FEATURE] #6

Open
LorenDorez opened this issue May 3, 2023 · 5 comments
Open

Support Multiple Configs [FEATURE] #6

LorenDorez opened this issue May 3, 2023 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@LorenDorez
Copy link

Is your feature request related to a problem? Please describe.
We leverage webpack to build multiple configs (ie Client and Server versions). I wanted to use this plugin to measure build times but can only do 1 config at a time which isnt ideal.

Describe the solution you'd like
SMP add this feature a while agao and since this seems to be the only active plugin to help measure performance i would like to see this added here as well.

@LorenDorez LorenDorez added the enhancement New feature or request label May 3, 2023
@ShuiRuTian
Copy link
Owner

Hi @LorenDorez, thanks for the request, which is pretty good. And if it's possible, could you please create a minimal repo to reproduce this issue?
It's not required, just want to make sure the fix would fit your situation.

@LorenDorez
Copy link
Author

Hi @ShuiRuTian ,

If i have time this weekend ill try to create one but basically any config work just duplicate it. We use the function syntax to gain access to the env variables

A quick mockup would be something like this

module.exports = (env, argv)  => {
     const config1 = {
        name: 'myconfig1',
        output: {
          filename: './dist-amd.js',
        },
        entry: './app.js',
        mode: 'production',
      };

     const config2 = {
        name: 'myconfig2',
        output: {
          filename: './dist-commonjs.js',
        },
        entry: './app2.js',
        mode: 'production',
      };

     return [config1, config2]
};

You can find about more options here as it would be nice to support all possible options webpack uses
https://webpack.js.org/configuration/configuration-types/#exporting-multiple-configurations

@ShuiRuTian
Copy link
Owner

ShuiRuTian commented May 8, 2023

@LorenDorez
Sorry for asking, how des SMP support it?

Does it wrap the function or the two configurations?


Auh, I got it, never mind :)

@LorenDorez
Copy link
Author

@ShuiRuTian
Copy link
Owner

Thanks!
I was too busy last week.
I made some change, and it starts to work, but it seems there are some multi-thread issues and it fails sometimes...
Hope I could fix it in this weekend...

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

No branches or pull requests

2 participants