Skip to content

Using direct imports of WebpackCssScopeLoader and WebpackScopedCssModulesLoader doesn't work #1

Closed
@Wiktor102

Description

@Wiktor102

This is an oversight of mine when developing the plugin. The package exports these loaders as functions, but webpack expects a string with a path to the plugin as the UseEntry. It then resolves that path using the configuration from resolveLoader.

TLDR:
Provide the path to loaders in your UseEntry array and DO NOT USE IMPORTS like in the readme. Here is an example using aliases:

resolveLoader: {
  alias: {
    "webpack-scoped-css-module-loader": path.resolve(__dirname, "node_modules/webpack-scoped-css/src/scopedCssModulesLoader.js"),
    "webpack-scoped-css-scope-loader": path.resolve(__dirname, "node_modules/webpack-scoped-css/src/cssScopeLoader.js")
  }
},

Then you can provide "webpack-scoped-css-module-loader" and "webpack-scoped-css-scope-loader" to your rule.use array.

When I have time, I'll try to update this package to handle all of this for you. Don't hesitate to ask if you've got any questions or suggestions about this.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions