Skip to content

fix(astro): Accessing import.meta at build causes app to break - #3675

Merged
panteliselef merged 2 commits into
mainfrom
elef/fix-astro-build
Jul 8, 2024
Merged

fix(astro): Accessing import.meta at build causes app to break#3675
panteliselef merged 2 commits into
mainfrom
elef/fix-astro-build

Conversation

@panteliselef

Copy link
Copy Markdown
Contributor

Description

Pretty much what the title says

Checklist

  • npm test runs as expected.
  • npm run build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

@panteliselef
panteliselef requested a review from wobsoriano July 8, 2024 17:34
@panteliselef panteliselef self-assigned this Jul 8, 2024
@changeset-bot

changeset-bot Bot commented Jul 8, 2024

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 282cce2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@clerk/astro Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@panteliselef

Copy link
Copy Markdown
Contributor Author

!snapshot

@clerk-cookie

Copy link
Copy Markdown
Collaborator

Hey @panteliselef - the snapshot version command generated the following package versions:

Package Version
@clerk/astro 0.0.2-snapshot.v282cce2
gatsby-plugin-clerk 5.0.0-beta.45
@clerk/testing 1.1.10-snapshot.v282cce2

Tip: Use the snippet copy button below to quickly install the required packages.
@clerk/astro

npm i @clerk/astro@0.0.2-snapshot.v282cce2 --save-exact

gatsby-plugin-clerk

npm i gatsby-plugin-clerk@5.0.0-beta.45 --save-exact

@clerk/testing

npm i @clerk/testing@1.1.10-snapshot.v282cce2 --save-exact

@wobsoriano wobsoriano left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm the error and it's probably the best to use the command property to check for the current environment instead.

Turns out, Astro config does not run inside Vite so import.meta.env won't work

@panteliselef

Copy link
Copy Markdown
Contributor Author

I've verified with the snapshot that this PR fixes the issue.

@panteliselef
panteliselef merged commit 5c3adbb into main Jul 8, 2024
@panteliselef
panteliselef deleted the elef/fix-astro-build branch July 8, 2024 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants