Skip to content

feat(loader): add exclude option (options.exclude) #763

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

Closed
wants to merge 1 commit into from

Conversation

daydayuphuan
Copy link

When I set modules to true, I want to ignore certain files, but I need to use these loaders again. I have no way to find a solution.

For example, my project uses monaco-editor, monaco-editor uses the import method in the component to load css, but it does not use the method like react -> className to set the class.

so I have to change it myself

add exclude to options

webpack.config

{
    test: /\.css$/,
    use: [
        {
            loader: 'style-loader'
        },
        {
            loader: 'css-loader',
            options: {
                modules: true,
                importLoaders: 1,
                localIdentName: '[name]_[local]',
                camelCase: true,
                exclude: [
                    path.resolve(__dirname, 'node_modules/monaco-editor')
                ]
            }
        },
        {
            loader: 'postcss-loader',
            options: {
                ident: 'postcss',
                plugins: function () {
                    return [
                        postcssImport,
                        postcssVars,
                        autoprefixer({
                            browsers: ['last 3 versions', 'Safari >= 8', 'iOS >= 8']
                        })
                    ];
                }
            }
        }
    ]
}

Hope to adopt, thx

@jsf-clabot
Copy link

jsf-clabot commented Aug 28, 2018

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


huange seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.

@michael-ciniawsky
Copy link
Member

@daydayuphuan This is in particlar for CSS Modules, right? You don't want certain files to be 'modulified' when using { modules: true } ?

@michael-ciniawsky
Copy link
Member

As a heads up we curretnly reworking the CSS Modules implementation as a whole and it will be removed from the css-loader directly in >= v2.0.0 (#760). Your feature request is a must have in the future but it's likely you will need to wait some time until it is implemented in an upcoming new plugin for CSS Modules we are working on. Let's discuss it for the current release line as proposed by your PR, but maybe you need to use your own fork in the meantime

@alexander-akait
Copy link
Member

Problem still exists?

@alexander-akait
Copy link
Member

Closing due to inactivity. Please test with latest version and feel free to reopen if still regressions. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants