-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
多页面应用,如何将每个页面自身的内容单独打包,例:dist/page1, dist/page2 ? #2861
Comments
本来想通过执行vue-cli-service build xxx,获取参数来动态传入pages的内容,发现vue.config.js里也接不到... |
3.x的版本限制的太死了,很多不如之前自己写那么灵活 |
@sodatea 兄dei 你发这个链接就不走心吧 |
请说清楚你的需求。 |
多页面配置没毛病,但是我想build出来的内容也能是独立的。即page1下包含完整的css,js,img等这些资源,page2也是。我看现在的情况,默认是混在一起,且vendors里包含了page1、page2共有的库。 |
@sodatea 有好的解决办法,或者思路吗? |
// vue.config.js
const configs = {
page1: {
outputDir: 'page1'
configureWebpack() {
return {
entry: 'src/page1.js'
}
}
},
page2: {
outputDir: 'page2',
configureWebpack() {
return {
entry: 'src/page2.js'
}
}
}
}
module.exports = configs[process.env.PAGE_CONF] PAGE_CONF=page1 && npm run build
# or
PAGE_CONF=page2 && npm run build |
@jkzing 您好,请教下如何打包目录下所有多页呢? |
@jkzing @sodatea 多谢两位,是这个思路。后来我通过参数判断了,类似build后面的
在vue.config.js里通过 let build = process.argv.slice(2)[1]; 获取build参数值来传入不同的 |
@qhhsy 看上面这行~
|
谢谢 |
这种情况需要指定打包的页面,能做成自动打包吗? |
+1 |
What problem does this feature solve?
多页面build时的输出问题
What does the proposed API look like?
能打包成多个独立模块
The text was updated successfully, but these errors were encountered: