Closed
Description
Version
15.8.3
Reproduction link
https://github.com/Lyrkan/repro-vue-loader-webpack5
Steps to reproduce
- Create a basic project using the latest version of
vue-loader
and Webpack 5 with the three following rules :
{ test: /\.js$/, use: [ { loader: 'babel-loader', options: {} } ] }
{ test: /\.css$/, use: [ { loader: 'css-loader', options: { url: true } } ] }
(url
can be replaced by any option that exists incss-loader
but not inbabel-loader
){ test: /\.vue$/, loader: 'vue-loader' }
-
Import a
.vue
file that contains a<script>
tag -
Try to compile the project
What is expected?
Should compile fine
What is actually happening?
The build fails because the url
option meant for the css-loader
is passed to the babel-loader
:
ERROR in ./src/App.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib??ruleSet[0].rules[0].use[0]!./node_modules/vue-loader/lib??vue-loader-options!./src/App.vue?vue&type=script&lang=js&)
Module build failed (from ./node_modules/babel-loader/lib/index.js):
ReferenceError: Unknown option: .url. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options.
It does not happen when using Webpack 4
It does not happen either when not using Rule.use
or when options
is not specified in the babel-loader
rule.