-
Notifications
You must be signed in to change notification settings - Fork 80
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
how about usage with multiple configs and a function with the env argument? #37
Comments
Hey @rosenfeld Just to clarify, do you mean a config like so? module.exports = env => {
return [conf1, conf2];
}; if so, then you can do the following: module.exports = env => {
return [conf1, conf2].map(smp.wrap);
}; however this isn't ideal... Ideally |
That was my first attempt. I tried that, then I tried to smp.wrap([conf1, conf2]) and finally smp.wrap( env => {}). That first attempt, like you suggested, didn't seem to give me the right stats and only seemed to print the stats for the first config. Did you give it a try? |
I did, but with a stupid fake example - entirely possible I missed any issues with the second config not actually getting measured. Sorry about that :/ I'll get a proper config example set-up, and look into this properly... |
That would be awesome, thanks! |
Sorry for the radio-silence on this one, been a hectic couple of weeks! I've raised #41 which should address multi-configs, and env-generated configs as first-party options So on that branch, the following would work module.exports = smp.wrap(env => [conf1, conf2]); or module.exports = env => smp.wrap([conf1, conf2]); whichever you prefer. I'd appreciate it if you could check out that branch, and confirm that everything works as expected for you, @rosenfeld, before I merge! |
Hmm, I need more time to test this. It basically worked as expected for one of my projects. But it finishes much before the build in the other project. Both are running webpack 4.5.0. Currently I'm on a tight deadline so it may take a while before I could investigate the differences between both configs that are causing this difference in the behavior of this plugin. Anyway, maybe it would be good to merge this since it works for some projects. Then I can open a new issue with a sample project if I can reproduce it so that it fixes the issue I'm having with this other project... Also, I noticed, in the project for which smp worked fine, that I couldn't see the minifying time when |
I have a private project I use to bootstrap new projects and that I intend to open-source once it's more polished. I can reproduce the issue in this project. Just let me know your gitlab account and I can share it with you. |
I have a gitlab account of the same name, @stephencookdev if you want to share that :) |
I just added you to the project. You should be able to reproduce by cloning the project and:
Then change webpack.config.babel.js to use SMP and you should notice that it will report before the build is finished. Just let me know if you have any questions. |
I'm using 1.3.2 of this plugin to wrap a function that returns 3 configs. The plugin throws no errors but only outputs stats based on the first config, instead of all 3. I have tried both of the formats suggested above:
The solution I have settled on for now is
Interesting note: When I didn't create a new object in the map function, the plugin still only output once, with the stats of the first config. |
My webpack configuration returns a function receiving the "env" argument and returns multiple configurations. How am I supposed to integrate SMP with such a config?
Thanks in advance!
The text was updated successfully, but these errors were encountered: