-
Notifications
You must be signed in to change notification settings - Fork 918
Description
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 theident
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 ause
array:{ test: /\.vue$/, use: [{ loader: 'vue-loader', options: {} }] }
As opposed to that, it does not occur if the
loader
andoptions
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 sincevue-loader
iterates over all loaders.)
Ultimately, I'm not sure if this is an issue with vue-loader
or rather with webpack
itself.