vuejs / vue-cli

🛠️ webpack-based tooling for Vue.js Development
https://cli.vuejs.org/
MIT License
29.78k stars 6.33k forks source link

Component built with --target wc throws "Vue is not defined" (Vue v.3.0.0) #5887

Open HackyDev opened 3 years ago

HackyDev commented 3 years ago

Version

4.5.6

Reproduction link

https://github.com/HackyDev/vue-starter

Environment info

  System:
    OS: Windows 10 10.0.18362
    CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
  Binaries:
    Node: 12.16.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.4 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.13.7 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 85.0.4183.102
    Edge: Spartan (44.18362.449.0)
  npmPackages:
    @vue/babel-helper-vue-jsx-merge-props:  1.0.0
    @vue/babel-helper-vue-transform-on:  1.0.0-rc.2
    @vue/babel-plugin-jsx:  1.0.0-rc.3
    @vue/babel-plugin-transform-vue-jsx:  1.1.2
    @vue/babel-preset-app:  4.5.6
    @vue/babel-preset-jsx:  1.1.2
    @vue/babel-sugar-functional-vue:  1.1.2
    @vue/babel-sugar-inject-h:  1.1.2
    @vue/babel-sugar-v-model:  1.1.2
    @vue/babel-sugar-v-on:  1.1.2
    @vue/cli-overlay:  4.5.6
    @vue/cli-plugin-babel: ~4.5.0 => 4.5.6
    @vue/cli-plugin-e2e-cypress: ~4.5.0 => 4.5.6
    @vue/cli-plugin-eslint: ~4.5.0 => 4.5.6
    @vue/cli-plugin-pwa: ~4.5.0 => 4.5.6
    @vue/cli-plugin-router: ~4.5.0 => 4.5.6
    @vue/cli-plugin-unit-jest: ~4.5.0 => 4.5.6
    @vue/cli-plugin-vuex:  4.5.6
    @vue/cli-service: ~4.5.0 => 4.5.6
    @vue/cli-shared-utils:  4.5.6
    @vue/compiler-core:  3.0.0
    @vue/compiler-dom:  3.0.0
    @vue/compiler-sfc: ^3.0.0 => 3.0.0
    @vue/compiler-ssr:  3.0.0
    @vue/component-compiler-utils:  3.2.0
    @vue/eslint-config-standard: ^5.1.2 => 5.1.2
    @vue/preload-webpack-plugin:  1.1.2
    @vue/reactivity:  3.0.0
    @vue/runtime-core:  3.0.0
    @vue/runtime-dom:  3.0.0
    @vue/shared:  3.0.0
    @vue/test-utils: ^2.0.0-beta.5 => 2.0.0-beta.5
    @vue/web-component-wrapper:  1.2.0
    eslint-plugin-vue: ^7.0.0-0 => 7.0.0-beta.3
    jest-serializer-vue:  2.0.2
    typescript: ~3.9.3 => 3.9.7
    vue: ^3.0.0 => 3.0.0
    vue-eslint-parser:  7.1.0
    vue-hot-reload-api:  2.3.4
    vue-jest: ^5.0.0-alpha.4 => 5.0.0-alpha.4 (3.0.7)
    vue-loader:  15.9.3 (16.0.0-beta.7)
    vue-loader-circular: github:HackyDev/vue-loader-circular#v0.1.0 => 0.1.0
    vue-router: ^4.0.0-beta.10 => 4.0.0-beta.10
    vue-style-loader:  4.1.2
    vue-template-es2015-compiler:  1.9.1
  npmGlobalPackages:
    @vue/cli: Not Found

Steps to reproduce

reproduction repo https://github.com/HackyDev/vue-starter

component built with "--target wc" https://github.com/HackyDev/vue-loader-circular

What is expected?

An imported component should work

What is actually happening?

Uncaught ReferenceError: Vue is not defined

insky commented 3 years ago

Same for Vue 2.6.11