question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to replace smart function when a specific loader in a chain needs to be overriden?

See original GitHub issue

The following works in webpack-merge 4.2.2, but the smart function has been removed. What I want is to override the configuration of the css-loader.

const base = {
        module: {
            rules: [
                {
                    test: /\.scss$/,
                    loaders: [
                        {
                            loader: MiniCssExtractPlugin.loader
                        },
                        {
                            loader: 'css-loader'
                        },
                        {
                            loader: 'postcss-loader',
                            options: {
                                plugins: function () {
                                    return [
                                        projectRequire('autoprefixer')
                                    ];
                                }
                            }
                        },
                        {
                            loader: 'resolve-url-loader'
                        },
                        {
                            loader: 'sass-loader',
                            options: {
                                sourceMap: true
                            }
                        }
                    ]
                }
            ]
        }
    }

    const development = {
        module: {
            rules: [
                {
                    test: /\.scss$/,
                    loaders: [
                        {
                            loader: 'css-loader',
                            options: {
                                sourceMap: true
                            }
                        }
                    ]
                }
            ]
        }
    }

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:15 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
bebrawcommented, Sep 25, 2020

@TorRanfelt I played around with the implementation. Here’s the proposed API: https://github.com/survivejs/webpack-merge/issues/146#issuecomment-698992119 .

mergeWithCustomize({
  customizeArray: customizeArray({
    "module.rules[test].loaders": CustomizeRule.Replace
  })
})

It’s going to need a small parser (parser generator even?) but I can map it from the selector syntax to code.

0reactions
bebrawcommented, Oct 7, 2020

You should be able to do this type of merge in 5.2.0. šŸ‘

Read more comments on GitHub >

github_iconTop Results From Across the Web

default override of virtual destructor - c++ - Stack Overflow
When you override virtual function, you replace it. The destructors are chained, so you can't override destructor literally.
Read more >
mod_filter - Apache HTTP Server Version 2.4
The FilterChain directive builds a filter chain from smart filters declared, offering the flexibility to insert filters at the beginning or end of...
Read more >
GNU GRUB Manual 2.06
1.1 Overview. Briefly, a boot loader is the first software program that runs when a computer starts. It is responsible for loading and...
Read more >
ASHP Guidelines on the Safe Use of Automated Dispensing ...
If a medica- tion stored in a restricted ADC is needed but there is not an active order on the patient profile, permission...
Read more >
spl_autoload_register - Manual - PHP
spl_autoload_register — Register given function as __autoload() implementation ... If true, spl_autoload_register() will prepend the autoloader on theĀ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found