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 webpack multiple configurations #98

Merged

Conversation

re-fort
Copy link
Contributor

@re-fort re-fort commented Jul 29, 2021

support when webpack config is exported multiple configurations.
it might be nice to select a configuration which one to use, but this PR does not add this option, it always uses the first one.

@re-fort
Copy link
Contributor Author

re-fort commented Oct 1, 2021

@mrjoelkemp could you review this PR?

@mrjoelkemp
Copy link
Collaborator

Thanks for this @re-fort. So that I understand this is fixing a bug where a multi-config causes this lib to break?

@mrjoelkemp
Copy link
Collaborator

Is it possible to have webpack choose the right config instead of doing that here by defaulting to the first one?

@re-fort
Copy link
Contributor Author

re-fort commented Oct 3, 2021

So that I understand this is fixing a bug where a multi-config causes this lib to break?

Yes, that's right.
when loading multiple webpack configurations, this lib doesn't work.

Is it possible to have webpack choose the right config instead of doing that here by defaulting to the first one?

it would be not able to do that, the right config needs to be selected by the user.
the solution to let the user choose which config to use:

  1. add an option to webpackConfig like
webpackConfig: {
  path: 'path/to/webpack/config',
  option: {
    webpackConfigIndex: 0
  }
}

if doing this, need to consider backward compatibility.

  1. create a new webpack config file for this lib like
const config = require('path/to/webpack/config')[0];
module.exports = config;

it's workaround and no need to change this lib.
it's a little weird for me that having the webpack config only for this library, so I made this PR.

@mrjoelkemp mrjoelkemp merged commit d11a7a9 into dependents:master Oct 3, 2021
@mrjoelkemp
Copy link
Collaborator

Thank you @re-fort. Appreciate the fix with a test. Thanks for contributing. Pushed this as a new patch version.

@re-fort re-fort deleted the support-webpack-multiple-configuration branch October 4, 2021 02:29
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 this pull request may close these issues.

2 participants