vue 项目开发环境怎么部署到public下 (已解决)

aspire

我在 webman public 目录下vue文件夹里部署运行开发环境了.

运行vue开发环境

App running at:
- Local:   http://localhost:9527/
- Network: http://172.16.1.129:9527/

Note that the development build is not optimized.
To create a production build, run npm run build.

nginx反向代理配置

location ^~ /vue
{
    proxy_pass http://172.16.1.129:9527/;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header REMOTE-HOST $remote_addr;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
    proxy_http_version 1.1;
    # proxy_hide_header Upgrade;
}

vue.config.js

1.

publicPath: '/',
outputDir: 'dist',
assetsDir: 'static',

这样会找不到js文件
2.

publicPath: './',
outputDir: 'dist',
assetsDir: 'static',

3.

publicPath: '/vue/',
outputDir: 'dist',
assetsDir: 'static',

2和3报错:

Uncaught SyntaxError: Unexpected token '<' (at chunk-vendors.js:1:1)
1141 1 1
1个回答

artisan

单独一个项目目录,然后软连接😄

  • aspire 2023-10-17

    然后怎么配置nginx?

  • TM 2023-10-19

    直接nginx访问vue项目index不就可以了吗

  • aspire 2023-10-23

    自身问题,原来是CDN缓存了。。。 😂

年代过于久远,无法发表回答
×
🔝