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

refactor: Specify css-loader options #161

Merged
merged 3 commits into from
Aug 1, 2024
Merged

Conversation

SimonAlling
Copy link
Owner

@SimonAlling SimonAlling commented Aug 1, 2024

I think this will make it easier to upgrade css-loader, which in turn I think will be necessary in order to upgrade to webpack 5.

At the time of writing, the latest version of css-loader that matches ^3.2.0 – and the one used in the bootstrapped userscript, SimonAlling/example-userscript@d1d30ea5 and SimonAlling/better-sweclockers@7381699f, according to npm why – is 3.6.0. I went here to check what its default options are, and then I specified them. For some of them, the documented default value isn't obviously correct/sensible:

  • hashPrefix

    The documented default value is undefined, but based on the source code, it's actually "". That makes much more sense to me too.

  • getLocalIdent

    The documented default value is undefined, but specifying that causes consuming userscripts (e.g. SimonAlling/example-userscript@d1d30ea5) to fail to build with this error:

    TypeError: modulesOptions.getLocalIdent is not a function
    
  • localIdentRegExp

    The documented default value is undefined, but based on the source code, it's actually null. Specifying null, however, causes consuming userscripts (e.g. SimonAlling/example-userscript@d1d30ea5) to fail to build with this error:

    Details:
     * options.modules.localIdentRegExp should be one of these:
       string | RegExp
       Details:
        * options.modules.localIdentRegExp should be a string.
        * options.modules.localIdentRegExp should be an instance of RegExp.
    

@SimonAlling SimonAlling marked this pull request as ready for review August 1, 2024 14:29
@SimonAlling SimonAlling merged commit d1b8b4f into master Aug 1, 2024
8 checks passed
@SimonAlling SimonAlling deleted the css-loader-options branch August 1, 2024 16:03
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