At deployment, before starting your application, you can perform a custom build
step by adding a gcp-build
script in your package.json
file.
When this script is executed, the dependencies in the dependencies
and
devDependencies
fields of your package.json
file are available.
After executing your custom build step, App Engine removes and regenerates the
node_modules
folder by only installing the production dependencies declared
in the dependencies
field of your package.json
file.
Example
A custom build script can be used for pre-processing tasks, such as
pre-processing CSS, minifying client side JavaScript, or running tools, such as
webpack
or gulp
.
For example, to compile TypeScript to JavaScript, your package.json
file might
look like the following. Note the gcp-build
script: