admin管理员组文章数量:1023815
I am using Vue3 & Vite. My question is, how can I configure entry point file of a page?
I have directory structure like this:
project_root
ㄴapps
ㄴapp1
ㄴpublic
ㄴindex.html
ㄴskeleton
ㄴsrc
ㄴmain.ts
...
index.html's body:
<body>
<div id="app"></div>
</body>
main.ts:
const app = createApp(SomeApp);
app.mount('#app');
I would like to use app1's index.html file and use skeleton/src/main.ts. How can I do this?
When I was using Vue2, I configured multi-page in vue.config.js like this:
pages: {
index: {
entry: '../skeleton/src/main.ts',
template: 'public/index.html',
filename: 'index.html',
title: 'Some Title',
},
I am using Vue3 & Vite. My question is, how can I configure entry point file of a page?
I have directory structure like this:
project_root
ㄴapps
ㄴapp1
ㄴpublic
ㄴindex.html
ㄴskeleton
ㄴsrc
ㄴmain.ts
...
index.html's body:
<body>
<div id="app"></div>
</body>
main.ts:
const app = createApp(SomeApp);
app.mount('#app');
I would like to use app1's index.html file and use skeleton/src/main.ts. How can I do this?
When I was using Vue2, I configured multi-page in vue.config.js like this:
pages: {
index: {
entry: '../skeleton/src/main.ts',
template: 'public/index.html',
filename: 'index.html',
title: 'Some Title',
},
Share
Improve this question
edited Nov 29, 2024 at 0:51
Rae
asked Nov 28, 2024 at 9:53
RaeRae
53 bronze badges
1 Answer
Reset to default 0Your index.html is the entry point and everything else is resolved based to its location. You can check docs for a way to specify alternative root. Don't fet to move vite.config.ts to the same directory as index.html.
Location of your main.ts is specified in the index.html:
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
Location of App.vue is specified in the main.ts file. You can further explore config possibilities with, say, checking how docs describe configuration of multi-page apps: https://vite.dev/guide/build.html#multi-page-app
I am using Vue3 & Vite. My question is, how can I configure entry point file of a page?
I have directory structure like this:
project_root
ㄴapps
ㄴapp1
ㄴpublic
ㄴindex.html
ㄴskeleton
ㄴsrc
ㄴmain.ts
...
index.html's body:
<body>
<div id="app"></div>
</body>
main.ts:
const app = createApp(SomeApp);
app.mount('#app');
I would like to use app1's index.html file and use skeleton/src/main.ts. How can I do this?
When I was using Vue2, I configured multi-page in vue.config.js like this:
pages: {
index: {
entry: '../skeleton/src/main.ts',
template: 'public/index.html',
filename: 'index.html',
title: 'Some Title',
},
I am using Vue3 & Vite. My question is, how can I configure entry point file of a page?
I have directory structure like this:
project_root
ㄴapps
ㄴapp1
ㄴpublic
ㄴindex.html
ㄴskeleton
ㄴsrc
ㄴmain.ts
...
index.html's body:
<body>
<div id="app"></div>
</body>
main.ts:
const app = createApp(SomeApp);
app.mount('#app');
I would like to use app1's index.html file and use skeleton/src/main.ts. How can I do this?
When I was using Vue2, I configured multi-page in vue.config.js like this:
pages: {
index: {
entry: '../skeleton/src/main.ts',
template: 'public/index.html',
filename: 'index.html',
title: 'Some Title',
},
Share
Improve this question
edited Nov 29, 2024 at 0:51
Rae
asked Nov 28, 2024 at 9:53
RaeRae
53 bronze badges
1 Answer
Reset to default 0Your index.html is the entry point and everything else is resolved based to its location. You can check docs for a way to specify alternative root. Don't fet to move vite.config.ts to the same directory as index.html.
Location of your main.ts is specified in the index.html:
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
Location of App.vue is specified in the main.ts file. You can further explore config possibilities with, say, checking how docs describe configuration of multi-page apps: https://vite.dev/guide/build.html#multi-page-app
本文标签: vuejs3How to change entry file in Vue3ViteStack Overflow
版权声明:本文标题:vuejs3 - How to change entry file in Vue3, Vite? - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745518393a2154194.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论