node.js - webpack打包后的静态资源,怎么直接访问?
巴扎黑
巴扎黑 2017-04-17 16:20:25
0
5
452

现在我做的一个项目是在electron下用vue.js + vue-router + webpack,我就是想问下,在项目打包后,直接打开index.html他是直接访问App.vue,但是我建的路由我试了N多方法,貌似都不行,比如:index.html/login,login是一个组件 login.vue。对了,在开发模式下(npm run dev)用http://localhost:8080/login,这样是可以正常访问的。

我现在能想到的解决方案有两个:
1、有没有什么办法在electron启动的时候启动一个server服务器?没试过,无从下手。
2、是不是webpack在没server的情况下,不能用路由?

求大神指点下。

巴扎黑
巴扎黑

reply all(5)
伊谢尔伦

hello. Can you use vue+express+webpack+mysql as an architecture project? Can you share it with me, dear. I am also learning this knowledge at the moment. Thank you very much if you can answer it

迷茫

You can take a look at http-server in npm

黄舟

http://localhost:8080/assert/...

黄舟

Have you set the history in the routing? If not, open it directly and it should be index.html#/login
If you want to use an http server
npm install -g live-server
Enter the dist folder and execute live-server

左手右手慢动作

I also have a question, how to directly access the static resource files packaged by webpack through the 3000 port opened by express. Describe the single page application I made.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template