我想将我的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)