In my typescript monorepo, a vue 3 app is importing custom types and config constants from modules/packages specifically created for the app, such as @myapp/types
or @myapp/config
. These packages are private and not pulled from the npm registry.
Locally, I have no issues with importing, building, or running the app. However, during Cloud Build, my builds consistently fail with the following error message:
https://i.sstatic.net/KTYOV.png
Below are the tsconfig.json files used in the "importer" repository, which is my Vue app utilizing the types and going through the pipeline:
tsconfig.json:
{
"files": [],
"compilerOptions": {
"forceConsistentCasingInFileNames": true,
"strict": true
},
"references": [
{
"path": "./tsconfig.vite-config.json"
},
{
"path": "./tsconfig.app.json"
},
{
"path": "./tsconfig.vitest.json"
},
{
"path": "../../packages/types/tsconfig.json"
},
{
"path": "../../packages/config/tsconfig.json"
}
]
}
tsconfig.app.json:
{
"extends": "@vue/tsconfig/tsconfig.web.json",
"include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
"exclude": ["src/**/__tests__/*"],
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"composite": true,
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"],
"@myapp/config": ["../../packages/config"],
"@myapp/types": ["../../packages/types"]
}
}
}
The structure of the monorepo looks like this:
- root (tsconfig.base.json)
- apps
- ui <== consumer (tsconfig.app.json + tsconfig.json)
- packages
- types <= custom types (tsconfig.json)
- config <= custom types
- apps
Just to add information, here's the tsconfig.json present in the types module:
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"target": "ESNext",
"module": "ES6",
"esModuleInterop": true,
"skipLibCheck": true,
"moduleResolution": "Node",
"allowSyntheticDefaultImports": true,
"emitDeclarationOnly": true
},
"files": ["index.ts"],
"display": "Types"
}
Moreover, here's the tsconfig.base.json situated at the root of the repo:
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"baseUrl": ".",
"forceConsistentCasingInFileNames": true,
"strict": true,
"composite": true,
"declaration": true,
"declarationMap": true,
"paths": {
"@myapp/types": ["./packages/types"],
"@myapp/config": ["./packages/config"],
"@myapp/ui": ["./packages/ui"],
"@myapp/ui-b2b": ["./apps/ui-b2b/src"],
"@myapp/ui-partners": ["./apps/ui-patners/src"],
"@myapp/api": ["./apps/api/src"]
}
}
}
Lastly, here's the content of my cloudbuild yaml file:
steps:
- name: node:16
entrypoint: npm
args: ["install"]
- name: node:16
dir: "apps/ui-b2b"
entrypoint: npm
env:
- "DEPLOYMENT_TARGET=$_DEPLOYMENT_TARGET"
- "VITE_RECAPTCHA_SITE_KEY=$_VITE_RECAPTCHA_SITE_KEY"
- "VITE_DYNAMIC_LINKS_DOMAIN=$_VITE_DYNAMIC_LINKS_DOMAIN"
- "VITE_API_URL=$_VITE_API_URL"
- "VITE_DISPOSABLE_API_KEY=$_VITE_DISPOSABLE_API_KEY"
- "VITE_GCP_AUTH_TENANT_ID=$_VITE_GCP_AUTH_TENANT_ID"
- "VITE_FIREBASE_CONFIG=$_VITE_FIREBASE_CONFIG"
- "VITE_BASE_DOMAIN=$_VITE_BASE_DOMAIN"
- "VITE_LOCAL=$_VITE_LOCAL"
- "VITE_STRIPE_ALLOW_PROMOTION_CODES=$_VITE_STRIPE_ALLOW_PROMOTION_CODES"
- "VITE_TOAST_DURATION=$_VITE_TOAST_DURATION"
- "VITE_SEARCH_API_KEY=$_VITE_SEARCH_API_KEY"
- "VITE_SEARCH_API_HOST=$_VITE_SEARCH_API_HOST"
- "VITE_SEARCH_API_PORT=$_VITE_SEARCH_API_PORT"
- "VITE_SEARCH_API_PROTOCOL=$_VITE_SEARCH_API_PROTOCOL"
args: ["run", "build:development"]
- name: "gcr.io/google.com/cloudsdktool/cloud-sdk"
entrypoint: "bash"
dir: "apps/ui-b2b"
args:
[
"-c",
"gcloud config set app/cloud_build_timeout 1600 && gcloud app deploy",
]
timeout: "1600s"
I've attempted various solutions like adjusting paths and removing references, but each time it results in different errors. Any insights on why this might be happening or how it can be resolved would be greatly appreciated.
Thank you in advance,