aws-amplify / amplify-hosting

AWS Amplify Hosting provides a Git-based workflow for deploying and hosting fullstack serverless web applications.
https://aws.amazon.com/amplify/hosting/
Apache License 2.0
454 stars 115 forks source link

Enable yarn berry #2895

Open vetan2 opened 2 years ago

vetan2 commented 2 years ago

Describe the solution you'd like I'd like to use yarn berry because of its better building speed due to zero-install. But currently yarn version is fixed to 1.22.15. I have tried setting node version to 16 then running corepack enable, or tried setting yarn version to 3.2.1 in Build image settings. But those did not work.

itseasy21 commented 2 years ago

In your preBuild phase you can enable yarn berry by adding the following commands:


phases:
   preBuild:
       commands:
         - yarn set version 3.2.1 # This enables yarn berry and all commands after this will use that
         - yarn config set nodeLinker node-modules # if you use node modules else remove it if you use pnp
         - yarn install
Octiony commented 3 months ago

Is this a dead feature request?

Octiony commented 3 months ago

actually i managed to do it easily by modifying the build script

Here is what I used:

// amplify.yml

version: 1
frontend:
  phases:
    preBuild:
      commands:
        - nvm use 20
        - corepack enable
        - yarn set version stable
        - yarn install
    build:
      commands:
        - yarn run build
  artifacts:
    baseDirectory: build
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*