vuejs / vue-loader

📦 Webpack loader for Vue.js components
MIT License
4.98k stars 915 forks source link

vue-loader get can not resolved after install any loader, I have to reinstall vue-loader #1755

Closed HomyeeKing closed 3 years ago

HomyeeKing commented 3 years ago

Version

15.9.4

Reproduction link

http://nothing.com

Steps to reproduce

webpack@ 4.44.0 webpack-cli@4.1.0

vue-loader @15.9.4 "vue-template-compiler": "^2.6.12",

What is expected?

run successfully

What is actually happening?

Vue packages version mismatch:

- vue@3.0.3 (/Users/wanghongye/Desktop/HomyeeKing/vue/vue3-ui-design/node_modules/vue/index.js)
- vue-template-compiler@2.6.12 (/Users/wanghongye/Desktop/HomyeeKing/vue/vue3-ui-design/node_modules/vue-template-compiler/package.json)
`Cannot read property 'parseComponent' of undefined`
haoqunjiang commented 3 years ago

Please provide a valid reproduction.

HomyeeKing commented 3 years ago

@sodatea

vue-loader : "^16.0.0-beta.8"

const { VueLoaderPlugin } = require('vue-loader-v16');
const { VueLoaderPlugin } = require('vue-loader');
const  VueLoaderPlugin  = require('vue-loader-v16');
const VueLoaderPlugin = require("vue-loader/lib/plugin");

I've tried every one ,but always happens error ....

which one is the exact way to import this loader  😫

image

haoqunjiang commented 3 years ago

Please please provide a reproduction repo. I don't even understand what you are trying to achieve here. Are you trying to use vue 3 or vue 2?

HomyeeKing commented 3 years ago

Please please provide a reproduction repo. I don't even understand what you are trying to achieve here. Are you trying to use vue 3 or vue 2?

it need webpack command, hard to repo,

in short: I'm using vue3, how to import vue-loader correctly and which is the proper version of vue-template-compiler

HomyeeKing commented 3 years ago

https://codesandbox.io/s/lively-https-hz0mo?file=/webpack/webpack.dev.config.js @sodatea

image

HomyeeKing commented 3 years ago

and everytime I install new loader, the vue-loader get can not be resolved...

haoqunjiang commented 3 years ago

Install vue-loader@next & @vue/compiler-sfc, and uninstall vue-template-compiler.

See https://github.com/vuejs/vue-next-webpack-preview for reference.

HomyeeKing commented 3 years ago

@vue/compiler-sfc

excellent! problem solved