0

I am trying to pack a web app using Google Cloud Builder.

I already have npm install working in a previous step of the same build.

File webpack.config.js is ready to use and tested outside Google Cloud Builder. It is cloned inside the /workspace in a previous step of this build.

How do I execute webpack command as a build step?

Alex Benfica
  • 408
  • 5
  • 17

2 Answers2

1

This is how I manage to run webpack inside Google Cloud Builder configuration script. I had to use the npx in order to execute it using the npm docker image.

This is a step to run webpack and goes inside the file cloudbuild.yaml

# run webpack
- name: 'gcr.io/cloud-builders/npm'
  entrypoint: 'npx'
  args: ['webpack']
  dir: '${_MY_APP_DIR}templates/react_app/build'
  timeout: 10s
Alex Benfica
  • 408
  • 5
  • 17
-1

Assuming you are using webpack version >=4: webpack --mode=production --config ./webpack.config.js

PlayMa256
  • 6,603
  • 2
  • 34
  • 54