小编Goo*_*Guy的帖子

将 React 应用程序部署到 gitlab 页面后出现空白页

我想将我的React应用程序(不是create-react-app,从skratch构建)部署到gitlab页面,所有作业都成功传递,但页面无法正常工作。我只有一张空白的白页。

我的 .gitlab-ci.yml

stages:
  - build
  - deploy

build:
  image: node:latest    
  stage: build
  script:
    - npm install   
    - npm run build
  artifacts:
    paths:
      - build/          

pages:
  image: alpine:latest
  stage: deploy
  variables:
    GIT_STRATEGY: none 
  script:
    - mv build public      
    - cd public 
  artifacts:
    paths:
      - public
Run Code Online (Sandbox Code Playgroud)

我的webpack,我将 common 与 prod 合并

webpack.common.js


module.exports = {
    resolve: {
        extensions: ['.js', '.jsx', '.ts', '.tsx'] 
    },
    entry: {
        index: './src/index.tsx'
    },
    output: {
        filename: "[name].[chunkhash].js",
        chunkFilename: "[name].[chunkhash].js",
        path: path.resolve(__dirname, "public"),
        publicPath: "/" …
Run Code Online (Sandbox Code Playgroud)

gitlab reactjs gitlab-ci

5
推荐指数
1
解决办法
1780
查看次数

标签 统计

gitlab ×1

gitlab-ci ×1

reactjs ×1