Skip to content

[v15.0.0-beta.2] Normalization of rules fails #1210

@loilo

Description

@loilo

Version

15.0.0-beta.2

Reproduction link

https://github.com/Loilo/repro-vue-loader-normalize

Steps to reproduce

Clone the repository and install npm dependencies:

git clone https://github.com/Loilo/repro-vue-loader-normalize.git
cd repro-vue-loader-normalize
npm install

Run webpack:

npx webpack

What is expected?

Webpack should compile.

What is actually happening?

Webpack fails with a very terse Cannot set property 'undefined-0' of undefined and no stack trace.


I've dug into the issue and can make some educated guesses about the details:

  • The normalization of a rule fails.
    It seems to have to do with setting the ident in particular.

    A stack trace is available if the normalization step is invoked manually (node standalone.js in the reproduction repo):

    require('webpack/lib/RuleSet').normalizeRule({
      test: /\.vue$/,
      use: [{
        loader: 'vue-loader',
        options: {}
      }]
    })
  • The error occurs if there's an options property on an object inside a use array:

    {
      test: /\.vue$/,
      use: [{
        loader: 'vue-loader',
        options: {}
      }]
    }

    As opposed to that, it does not occur if the loader and options properties are attached to the rule directly:

    {
      test: /\.vue$/,
      loader: 'vue-loader',
      options: {}
    }
  • The problem happens on every loader, it doesn't need to be the vue-loader itself. (Although that's not unexpected since vue-loader iterates over all loaders.)

Ultimately, I'm not sure if this is an issue with vue-loader or rather with webpack itself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions