gitlab/Vue-cli4配置/Nginx配置单页面应用/w

2021-07-20  本文已影响0人  99ZY

Docker + gitlab

解决问题列表:

1、映射数据卷 在本机存在写入权限问题,无法启动,暂时性的解决办法就是不要做数据卷映射,但是会造成数据迁移、查看日志不方便等问题

2、git clone 地址无法解析的问题,解决办法如下

/* 进入容器,执行以下命令 */
vi /etc/gitlab/gitlab.rb  
/*在上述文件中 添加以下语句,IP地址为自己服务器IP */

#vim /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml (这个文件没用,请修改gitlab.rb)
external_url  'http://Your IP Adress:9001' 
nginx['listen_port'] = 9001

Vue-cli 4.0打包配置

module.exports = {
    // 公共路径(必须有的),history模式直接用 ‘/’
    publicPath: "./",
    // 输出文件目录
    outputDir: "dist",
    // 静态资源存放的文件夹(相对于ouputDir)
    assetsDir: "assets",
    // eslint-loader 是否在保存的时候检查(果断不用,这玩意儿我都没装)
    lintOnSave: false,
    // 我用的only,打包后小些
    // compiler: false,//有
    productionSourceMap: true, // 不需要生产环境的设置false可以减小dist文件大小,加速构建
    // css相关配置(我暂时没用到)
    // css: {
    // 是否使用css分离插件 ExtractTextPlugin
    // extract: true,
    // 开启 CSS source maps?
    // sourceMap: false,
    // css预设器配置项
    // loaderOptions: {},
    // 启用 CSS modules for all css / pre-processor files.
    // modules: false
    // },
    // webpack-dev-server 相关配置
    devServer: {
        proxy: {
            '/api': {
                target: 'https://api.inews.qq.com/',
                ws: true,
                changeOrigin: true,
                pathRewrite: {
                    '^/api': ''  //通过pathRewrite重写地址,将前缀/api转为/
                }
            }
        }
        //open: true,  // npm run serve后自动打开页面
        // host: '0.0.0.0',  // 匹配本机IP地址(默认是0.0.0.0)
        // port: 8080, // 开发服务器运行端口号
        // proxy: null,
        // 注:目前本项目暂时没有写后台接口,没有跨域问题,暂时不配置proxy
    },
}

NGINX 发布单页面应用 支撑路由 history模式

路由 history模式 如 http://www.XXX.com/path1/path2/home
vue默认路由为哈希模式,如:http://www.XXX.com#path1/path2/home

    # 配置 history 模式访问模式(方法一)(初始化进入网页network会报错404,但是不影响访问)
        location / {
           index index.html;
           error_page 404 /index.html;
        }
    # 配置 history 模式访问模式(方法二)(更好,初始化进入网页不会报错)
      #location / {
      # try_files $uri $uri/ /index.html;
      #}

Webstorm + vue 提示Eslint this.cliEngine is not a constructor 错误

方法一:
将this.CliEngine = require(this.basicPath + "lib/cli-engine"); 更改为 this.CliEngine = require(this.basicPath + "lib/cli-engine").CLIEngine;
然后重启webstorm

方法二:
stackoverflow上的解决方法
1)升级webstorm 到2019版本
2)降级eslint 到5

npm install --save-dev eslint@5

四则运算

查看链接--四则运算

上一篇 下一篇

猜你喜欢

热点阅读