components
components copied to clipboard
Stage parameter not taken into consideration on hook and dist input parameters
Description
Hi folks . We are finding that the template below doesn't work. the stage parameter is just not taken into account on the hook (removed it on the example below) or the dist parameters.
Example error when trying the stage variable on dist
Error: ENOENT: no such file or directory, stat 'C:\dev\something\dist-${stage}'
Anything I m doing wrong?
Additional Data
name: something
component: website
stage: dev
provider:
name: aws
region: eu-central-1
stage: ${stage}
inputs: # The configuration the Component accepts
src:
src: ./src
hook: yarn run build:staging
dist: ./dist-${stage}
#domain: serverless.com
bucketName: ${stage}-${name}-code-bucket
indexDocument: index.html
errorDocument: error.html
I can also not get this working:
app: online-surveys-ui
name: online-surveys-ui
org: nathansainsburyjisc
component: website
stage: dev
provider:
name: aws
runtime: nodejs12.x
profile: online-surveys
inputs:
src:
src: ./src
hook: npm run build:${stage}
dist: ./build
When running:
sls deploy --stage dev
or
sls deploy --stage prod
I get the following error:
Serverless › Failed running "src.hook": "npm run build:${stage}" due to the following error: "undefined"
My packagage.json
has these scripts:
"scripts": {
"start": "react-scripts start",
"start:local": "REACT_APP_ENV=local HOST=0.0.0.0 react-scripts start",
"build:local": "REACT_APP_ENV=local react-scripts build",
"build:dev": "REACT_APP_ENV=dev react-scripts build",
"build:prod": "REACT_APP_ENV=prod react-scripts build",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
}
Also, I'm using:
components version: 3.1.3