microsoft / griffel

CSS-in-JS with ahead-of-time compilation ⚡️
https://griffel.js.org
MIT License
1.2k stars 61 forks source link

webpack-loader: invalid schema for `webpackResolveOptions.plugins` #578

Closed layershifter closed 4 months ago

layershifter commented 4 months ago

@griffel/webpack-loader has invalid schema for webpackResolveOptions.plugins.

// webpack.config.js

class ResolvePlugin {
  apply(resolver) {}

module.exports = {
module: {
  rules: [
    {
      test: /\.js$/,
      exclude: /node_modules/,
      loader: "@griffel/webpack-loader",
      options: {
        webpackResolveOptions: {
          plugins: [new ResolvePlugin()],
        },
      },
    },
  ],
},

The config above fails with:

    ModuleBuildError: Module build failed (from ./index.ts):
    ValidationError: Invalid options object. Loader has been initialized using an options object that does not match the API schema.
     - options.webpackResolveOptions.plugins should be one of these:
       "..." | object { … }
       Details:
        * options.webpackResolveOptions.plugins should be a "...".
        * options.webpackResolveOptions.plugins should be "...".
        * options.webpackResolveOptions.plugins should be an object:
          object { … }

      68 |     webpackResolveOptions,
      69 |     ...babelConfig
    > 70 |   } = this.getOptions(optionsSchema);