Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to library a window var #7318

Open
406087475 opened this issue Oct 21, 2022 · 0 comments
Open

how to library a window var #7318

406087475 opened this issue Oct 21, 2022 · 0 comments

Comments

@406087475
Copy link

Version

5.0.8

Reproduction link

None

Environment info

windows

Steps to reproduce

最简单的初始化项目
vue create hello-world

调整main.js,输出aa函数
import { createApp } from 'vue'
import App from './App.vue'

createApp(App).mount('#app')

function aa () {
console.log(1)
}

export { aa }

调整vue.config.js,希望打包出window.Vue3
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
filenameHashing: false,
transpileDependencies: true,
configureWebpack: {
output: {
library: Vue3,
libraryTarget: 'umd'
}
}
})

What is expected?

希望script标签引入打包后的文件,页面window.Vue3能使用

What is actually happening?

结果,window.Vue3 undefined

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant