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

validate compiler options in multicompiler mode #15460

Merged
merged 12 commits into from May 8, 2024

Conversation

vankop
Copy link
Member

@vankop vankop commented Mar 2, 2022

What kind of change does this PR introduce?
feature
closes #14843

Did you add tests for your changes?
yes

Does this PR introduce a breaking change?
no

What needs to be documented once your changes are merged?
nothing

@webpack-bot
Copy link
Contributor

For maintainers only:

  • This needs to be documented (issue in webpack/webpack.js.org will be filed when merged)
  • This needs to be backported to webpack 4 (issue will be created when merged)

@TheLarkInn TheLarkInn mentioned this pull request May 2, 2023
13 tasks
@vankop
Copy link
Member Author

vankop commented Apr 12, 2024

@alexander-akait what do you think about this PR? should we somehow define unique name in this case?

@alexander-akait
Copy link
Member

alexander-akait commented Apr 12, 2024

@vankop I think validation of the uniqueName make sense too, because using the same can be problems too, for better dx let's generate a new unique name (just add a number based on index if multicompiler array) and output a warning

@vankop vankop force-pushed the feature/issue-14843 branch 3 times, most recently from 4f0f92c to e39095e Compare April 12, 2024 17:00
@vankop vankop force-pushed the feature/issue-14843 branch 4 times, most recently from a46748e to 832434e Compare April 12, 2024 20:44
@vankop
Copy link
Member Author

vankop commented Apr 13, 2024

@alexander-akait fixed. As I understand cache does not work correctly with same name, so name always should be unique

@vankop
Copy link
Member Author

vankop commented May 7, 2024

fixed @alexander-akait

const cacheNames = new Set();
return (cache, i) => {
if (!cache) return cache;
if (cache === true) return true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a test where we have two true values and so don't have any problems

@alexander-akait
Copy link
Member

alexander-akait commented May 7, 2024

@vankop I made some improvements of your idea

  • avoid extra loops (better perf), we already apply webpack default options, so for multi compiler mode we can just pass index of compiler and make default name using this index
  • by default we use name and mode for cache names, so let's respect if for multi compiler mode (i.e. when both configuration doesn't have name, we use name + mode + compiler_index)
  • now we output the warning if you have name: "default" for both compilers (test cases added)
  • if you have node API for webpack you don't need to apply new default, we will do it under the hood (better DX)

@alexander-akait
Copy link
Member

Also always output warnings when you explicitly set the same cache names

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to merge and merge if it is ok

@alexander-akait
Copy link
Member

We need fix our tests and do not run cache test for basic test, I will tr to fix it tomorrow or you can do it, thank you

@webpack-bot
Copy link
Contributor

@vankop Thanks for your update.

I labeled the Pull Request so reviewers will review it again.

@alexander-akait Please review the new changes.

@alexander-akait alexander-akait merged commit a705dca into main May 8, 2024
44 of 47 checks passed
@alexander-akait alexander-akait deleted the feature/issue-14843 branch May 8, 2024 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Need's Release
Development

Successfully merging this pull request may close these issues.

add hint/warning for the same cacheLocation in multi compiler mode
3 participants