You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While running dev server, developers can import variables from astro.config.mjs. However, when trying to build the project, these settings aren't accessible. Vite throws an error that's not easily traceable to the problem:
/home/projects/github-sdtx5j/node_modules/astro/dist/vite-plugin-env/index.js:57:12: ERROR: Expected ":" but found "/"
file: /home/projects/github-sdtx5j/node_modules/astro/dist/vite-plugin-env/index.js
Expected ":" but found "/"
Stack trace:
at failureErrorWithLog (/home/projects/github-sdtx5j/node_modules/esbuild/lib/main.js:1640:15)
at sendRequest/responseCallbacks[id] (/home/projects/github-sdtx5j/node_modules/esbuild/lib/main.js:693:17)
at readFromStdout (/home/projects/github-sdtx5j/node_modules/esbuild/lib/main.js:669:27)
at addChunk (node:internal/streams/readable:105:4109)
at Readable.prototype.push (node:internal/streams/readable:105:2679)
at _0x5c34e8/< (https://githubsdtx5j-ydgt.w-corp.staticblitz.com/blitz.a2aabdd9.js:350:285116)
at _0x36e207 (https://githubsdtx5j-ydgt.w-corp.staticblitz.com/blitz.a2aabdd9.js:350:283439)
at _0x2f2bfc/< (https://githubsdtx5j-ydgt.w-corp.staticblitz.com/blitz.a2aabdd9.js:350:285963)
at _0x30a600 (https://githubsdtx5j-ydgt.w-corp.staticblitz.com/blitz.a2aabdd9.js:352:156754)
Coming from another SSG, it may appear counterintuitive that one's own site settings aren't accessible during the build. To make things worse, developers may only discover the issue upon deployment, as the dev server doesn't give any warnings about the issue.
I would find it helpful to add one or two lines to the docs about the config:
Note that the Astro config is not accessible to components. To apply settings to both the Astro config and components, create a separate consts file and import it where needed.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
While running dev server, developers can import variables from astro.config.mjs. However, when trying to build the project, these settings aren't accessible. Vite throws an error that's not easily traceable to the problem:
Coming from another SSG, it may appear counterintuitive that one's own site settings aren't accessible during the build. To make things worse, developers may only discover the issue upon deployment, as the dev server doesn't give any warnings about the issue.
I would find it helpful to add one or two lines to the docs about the config:
Beta Was this translation helpful? Give feedback.
All reactions