Files
grafana/project.json
T
Jack Westbrookandjoshhunt bc295eefc0 Build: Separate Swagger from Grafana assets (#123798)
* feat(pkg/api): render swagger from separate swagger asset path

* build(webpack): remove swagger entrypoint from grafana config

* build(swagger): add separate webpack config and move assetsManifest plugin settings to shared file

* chore: bump webpack-assets-manifest plugin to latest

* chore(webpack): tidy up webpack dev and prod configs

* build(webpack): use multi configs to build both grafana and swagger in prod, update scripts

* chore(devenv): update local_cdn path for current local grafana version

* test(webassets): fix failing tests

* ci(schemav2-e2e): separate backend and frontend builds to prevent out of mem errors

* chore: remove unused @types/webpack-assets-manifest package

* fix(webassets): only consider react 19 for grafana builds

* build(frontend): raise node heap limit to 8gb to prevent oom in production builds

* Swagger: fix public path derivation for build-swagger output dir

The swagger entry derives __grafana_public_path__ by stripping the build
directory from webpack's public path, but still looked for 'build/' which
never matches the new 'build-swagger/' output dir. The strip returned -1 and
the public path fell back to public/build-swagger/, so @grafana/ui icons and
fonts resolved to public/build-swagger/build/... and 404ed.

* Build: give build:swagger its own Nx target instead of claiming it from dev

The dev target listed public/build-swagger as an output, but its command only
runs webpack.dev.ts; the swagger bundle is built afterwards by the chained
yarn build:swagger, outside the dev target. A dev cache hit could therefore
restore a stale or empty build-swagger tree. Declare the outputs on an
explicit build:swagger target so Nx caches the swagger build under the
target that actually produces it. The build target keeps both output dirs
since the prod webpack multi-config emits both in one invocation.

---------

Co-authored-by: joshhunt <josh.hunt@grafana.com>
2026-07-31 15:20:33 +01:00

60 lines
1.6 KiB
JSON

{
"name": "grafana",
"$schema": "node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"targets": {
"start": {
"dependsOn": [
"check-frontend-dev",
"themes-generate",
{
"projects": ["tag:scope:plugin"],
"target": "build"
}
]
},
"build": {
"dependsOn": [
"themes-generate",
{
"projects": ["tag:scope:plugin"],
"target": "build"
}
],
"outputs": ["{workspaceRoot}/public/build", "{workspaceRoot}/public/build-swagger"],
"cache": true
},
"dev": {
"dependsOn": [
"themes-generate",
{
"projects": ["tag:scope:plugin"],
"target": "build"
}
],
"outputs": ["{workspaceRoot}/public/build"],
"cache": true
},
"build:swagger": {
"dependsOn": ["themes-generate"],
"outputs": ["{workspaceRoot}/public/build-swagger"],
"cache": true
},
"themes-generate": {
"inputs": [
"{workspaceRoot}/scripts/cli/generateSassVariableFiles.ts",
"{workspaceRoot}/packages/grafana-data/src/themes/**",
"{workspaceRoot}/packages/grafana-ui/src/themes/**",
"{workspaceRoot}/package.json"
],
"outputs": [
"{workspaceRoot}/public/sass/_variables.generated.scss",
"{workspaceRoot}/public/sass/_variables.dark.generated.scss",
"{workspaceRoot}/public/sass/_variables.light.generated.scss",
"{workspaceRoot}/public/app/features/theme-playground/schema.json"
],
"cache": true
}
}
}