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

BUGFIX: Dont resolve css files which are not matched in cssModulesMatch #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mhsdesign
Copy link

@mhsdesign mhsdesign commented Nov 23, 2022

thanks for this plugin, its the best so far for esbuild :D

if one has an "exluded" package and also dont want it to be touched by this plugin one needs to use such options:

    external: ["@fortawesome/fontawesome-svg-core"],
    plugins: [
        stylePlugin({
            // process all .css files
            // but exclude those files that are in the dir
            // - @fortawesome/fontawesome-svg-core
            cssModulesMatch: /^(?!@fortawesome\/fontawesome-svg-core).*\.css$/,

but that will fail, as this plugin handles the resolving for "@fortawesome/fontawesome-svg-core/styles.css" so we explicitly check again against the user provided regex.

TODO - run tests :D

workaround:

add such a plugin:

{
    name: 'my-build',
    setup: ({onResolve}) => {
        onResolve({filter: /^@fortawesome\/fontawesome-svg-core\//, namespace: "file"}, () => ({
            external: true, 
            sideEffects: false
        }))
    }
},

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.

1 participant