Open dtinth opened 9 months ago
Thank you for opening this issue and linking back.
Please update and scale the Oryx to support for pnpm, so it can reach a broader audience including OSS developers who switched to pnpm and businesses using Azure Static Web Apps.
This would be helpful to my team as well!
What about using pnpm/action-setup@v3 ?
Or you can just work with Azure and use _PRE_BUILDCOMMAND & _CUSTOM_BUILDCOMMAND commands like:
- name: Build And Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
env:
PRE_BUILD_COMMAND: npm install -g pnpm
CUSTOM_BUILD_COMMAND: pnpm install --frozen-lockfile && pnpm run build
@GalindoSVQ From my experience deploying a NextJS app last week, these PRE_BUILD_COMMAND and CUSTOM_BUILD_COMMAND variables did work to some extent.
The blocker was that during the Azure Functions build phase, npm install --production
would always run regardless and I could not find a way to override that part of the pipeline. I was forced to alter my app deps to use npm to successfully deploy.
@GalindoSVQ From my experience deploying a NextJS app last week, these PRE_BUILD_COMMAND and CUSTOM_BUILD_COMMAND variables did work to some extent.
The blocker was that during the Azure Functions build phase,
npm install --production
would always run regardless and I could not find a way to override that part of the pipeline. I was forced to alter my app deps to use npm to successfully deploy.
react app boostraped using vite works fine, I am not sure but.. have you tried specifying pnpm as engine in package.json?
https://docs.npmjs.com/cli/v10/configuring-npm/package-json#engines
react app boostraped using vite works fine
That makes sense to me, it's probably a static app that doesn't have APIs/backend and doesn't use Azure Functions? Or maybe your project isn't pruning dev dependencies and you're not hitting the same build/deploy path I am.
I don't think specifying pnpm in package.json will make a difference. Everything in Oryx seems hardcoded to use npm or yarn exclusively.
I can track the problem here for my specific blocker (in case it helps the maintainers in any way), where ProductionOnlyPackageInstallCommand
always runs and there are no overrides to make packageInstallCommand
be pnpm install
.
This is impacting my attempt to execute a static site build from ADO using AzureStaticWebApp@0
because it forces the build_command to use yarn 1.x, not 4.2.1 as defined in my package.json packageManager config.
Per the docs (https://github.com/microsoft/Oryx/blob/main/doc/runtimes/nodejs.md#package-manager) package manager is currently derived (incorrectly in my case) rather than simply reading the value!
same issue here cannot use pnpm
+1
Feature Request
From https://github.com/microsoft/Oryx/issues/1150#issuecomment-1886067023
I feel strongly about this and decided to open a new issue.
My suggestions is at follows:
packageManager
key inpackage.json
.corepack enable
npm install
/yarn install
/pnpm install
depending on the package manager namenpm install
as beforeHow this will improve things:
Azure Static Site and Azure Web Service users can build their app without having to set up
PRE_BUILD_COMMAND
andCUSTOM_BUILD_COMMAND
. I use Netlify and Vercel, and they are supported out-of-the-box, so I expect the same in other hosting services. Azure services not recognizing pnpm in my project is a turn off for me.GitHub Codespaces currently run
npm install
even in pnpm projects. This means not only it takes a longer time for Codespace to initialize pnpm projects (due to waiting for npm install), afterwards I have to go ahead andrm -rf node_modules package-lock.json
and runpnpm install
again.In short, supporting pnpm via corepack will improve both developer experience in Codespaces and deployment experiences in Azure services.