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

Having issues while updating from 4.2.2 to 5.1.4 #148

Closed
ioanungurean opened this issue Sep 11, 2020 · 9 comments
Closed

Having issues while updating from 4.2.2 to 5.1.4 #148

ioanungurean opened this issue Sep 11, 2020 · 9 comments

Comments

@ioanungurean
Copy link

ioanungurean commented Sep 11, 2020

Hi, as I did not see an upgrade guide I willl post it here. I was using the smartStartegy before and I tried to use the new API but for some reason the merge is not happening as before.

  return merge.smartStrategy({
    "module.rules.use": "prepend"
  })

Is the code below equivalent to the one above? What am I doing wrong?

  return mergeWithCustomize({
    customizeArray: customizeArray({
      "module.rules.use.*": "prepend",
    }),
  })

Here is a link to the repo if that helps.

Thank you in advance for looking over my issue. And I appologise if this is not the right place to post this issue.

@bebraw
Copy link
Member

bebraw commented Sep 12, 2020

Hi,

Can you send me a simple example (two minimal configurations + output after merge) to help developing this feature? Is the idea to match based on test and then merge at use? Given this is specific logic, it doesn't fit the current syntax.

I've been exploring a light solution related to this at issue 146. The use case is far more complex there but it's possible what you have here would fit into the problem.

@bebraw
Copy link
Member

bebraw commented Oct 8, 2020

@ioanungurean I added a new API called mergeWithRules. Can you check if it would work for your use case?

@ioiooi
Copy link

ioiooi commented Oct 11, 2020

Having the same problem. mergeWithRules didn't help.

Going to stay at v 4.2.2.
link to repo

@bebraw
Copy link
Member

bebraw commented Oct 11, 2020 via email

@bebraw
Copy link
Member

bebraw commented Oct 11, 2020

@ioiooi Ah, nevermind. Just saw your link a second too late. I'll check how it would work with v5.

@bebraw
Copy link
Member

bebraw commented Oct 11, 2020

@ioiooi If you want to use v5, it looks like the following is a good option in your case:

const common = require('./webpack.common.js');
const { mergeWithCustomize, customizeArray } = require('webpack-merge');
const webpack = require('webpack');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');

module.exports = mergeWithCustomize({
  customizeArray: customizeArray({
    'module.rules': 'prepend'
  }),
})(common, {...})

I noticed mergeWithRules won't work due to mini-css-extract-plugin for this case.

@ioiooi
Copy link

ioiooi commented Oct 11, 2020

@bebraw sorry, for not isolating the issue and making it harder for you to work with.

Your suggestion works! Thank you! 👍

@bebraw
Copy link
Member

bebraw commented Oct 11, 2020

@ioiooi No worries, it was easy enough to work against your repository. Have a nice week. 👍

@bebraw
Copy link
Member

bebraw commented Oct 16, 2020

I'm closing this one. Feel free to open a new issue if the new API doesn't work for your use case.

@bebraw bebraw closed this as completed Oct 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants