Search code examples
azure-devopsazure-static-web-apporyx

Azure DevOps Oryx build of my ReactJS app fails with 'unable to resolve' error


I have a small ReactJS (using TypeScript) application that builds and runs locally no problem. It uses Vite to build and run the app locally. Works just fine.

But when building in Azure DEvOps for deployment as an Azure Static Web App I get the following compilation error:

x Build failed in 642ms
error during build:
Could not resolve "../../Api/SomeApi" from "src/pages/SomeFolder/MyPage.tsx"
file: /working_dir/src/pages/SomeFolder/MyPage.tsx
    at getRollupError (file:///working_dir/node_modules/rollup/dist/es/shared/parseAst.js:396:41)
    at error (file:///working_dir/node_modules/rollup/dist/es/shared/parseAst.js:392:42)
    at ModuleLoader.handleInvalidResolvedId (file:///working_dir/node_modules/rollup/dist/es/shared/node-entry.js:20212:24)
    at file:///working_dir/node_modules/rollup/dist/es/shared/node-entry.js:20172:26

The import from "../../Api/Identity" looks like:

import { HttpResponse, XResponse, YResponse, ZCreateRequest, AResponse, UserType, AUpdateRequest } from "../../Api/SomeApi";

(names change to protect the guilty)

The Azure DevOps pipeline task for the static web app build looks like:

  - task: AzureStaticWebApp@0
    inputs:
      azure_static_web_apps_api_token: $(AZURE_STATIC_WEB_APPS_API_TOKEN_WORDY_WORD_0F24ECA0F)
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
      app_location: "/" # App source code path
      api_location: "" # Api source code path - optional
      output_location: "build" # Built app content directory - optional
###### End of Repository/Build Configurations ######

I have no clue why the oryx tool fails to build the app. There does not appear to be a way to install the oryx tool on my dev machine (lots of documentation about the commands you can issue... just not a single word about how to install the dang thing).

Any help would be appreciated.


Solution

  • Fixed. The underlying issue was case-sensitive folder names. In windows "../../Api/Whatever" is the same as "../../api/Whatever". In Linux... nope. "Api" and "api" are separate and distinct.

    Thanks everyone for your time!!

    Thanks to our tireless DevOps engineers for spotting this.