Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove second snowpack instance #368

Merged
merged 3 commits into from
Jun 11, 2021
Merged

Conversation

matthewp
Copy link
Contributor

@matthewp matthewp commented Jun 9, 2021

Changes

This gets rid of having 2 snowpack instances. Instead there's just one, but no more import.meta.env.astro. So this is a breaking chance.

People can use import.meta.env.SSR for the same purpose.

Testing

  • [✅] Tests are passing
  • [✅] Tests updated where necessary

Docs

This wasn't documented, I'm adding it.

@matthewp matthewp requested a review from a team as a code owner June 9, 2021 20:24
@changeset-bot
Copy link

changeset-bot bot commented Jun 9, 2021

🦋 Changeset detected

Latest commit: 300b9e7

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

This PR includes changesets to release 1 package
Name Type
astro Minor

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

@vercel
Copy link

vercel bot commented Jun 9, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/pikapkg/astro-www/8PmkjRMjMe93kJQwsHrcFZrJ5deQ
✅ Preview: https://astro-www-git-there-can-be-only-one-snowpack-pikapkg.vercel.app

@matthewp
Copy link
Contributor Author

matthewp commented Jun 9, 2021

Closes #357

@FredKSchott
Copy link
Member

Oh my god this just feels so much better! Output looks good and feels faster too.

Saw one issue when running this on snowpack.dev main branch:

[build] Error: Error: No renderer found for PluginSearchPage:load! Did you forget to add a renderer to your Astro config?
    at file:///Users/fks/Code/astro/packages/astro/src/build/page.ts:98:44
    at async Promise.all (index 0)
    at buildStaticPage (file:///Users/fks/Code/astro/packages/astro/src/build/page.ts:96:3)
    at file:///Users/fks/Code/astro/packages/astro/src/build.ts:78:9
    at async Promise.all (index 30)
    at build (file:///Users/fks/Code/astro/packages/astro/src/build.ts:75:5)
    at buildAndExit (file:///Users/fks/Code/astro/packages/astro/src/cli.ts:16:15)

@FredKSchott
Copy link
Member

Also HMR is no longer connecting in dev, also on the Snowpack repo (seems to be trying to connect to localhost:3000)

@matthewp
Copy link
Contributor Author

@FredKSchott maybe you can show me how you're running a local copy of astro in that repo. I haven't been able to get it to work.

@matthewp
Copy link
Contributor Author

HMR issue is unrelated to this change. Fixed it here: #375

@matthewp
Copy link
Contributor Author

Ok, that took longer that it should have. @FredKSchott reason that component throws is because it depends on the very env variable that this PR removes support for. So changing it to use import.meta.env.SSR instead fixes it.

};

return {
runtimeConfig,
load: load.bind(null, runtimeConfig),
shutdown: () => Promise.all([backendSnowpack.shutdown(), frontendSnowpack.shutdown()]).then(() => void 0),
shutdown: () => Promise.all([snowpack.shutdown()]).then(() => void 0),
Copy link
Member

Choose a reason for hiding this comment

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

Maybe remove the Promise.all() ? Unless we need to add more cleanup relatively soon

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh yeah good point

Copy link
Member

@drwpow drwpow left a comment

Choose a reason for hiding this comment

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

🎉 🎉 🎉

@drwpow
Copy link
Member

drwpow commented Jun 10, 2021

.changeset/rare-nails-sneeze.md 🤨

Copy link
Member

@FredKSchott FredKSchott left a comment

Choose a reason for hiding this comment

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

LGTM! Plz run it on snowpack.dev if you can to confirm

@matthewp
Copy link
Contributor Author

@FredKSchott Yep, I did, that's what this comment was in reference to: #368 (comment)

I'll update snowpack.dev once this is released.

@matthewp matthewp merged commit 1bab906 into main Jun 11, 2021
@matthewp matthewp deleted the there-can-be-only-one-(snowpack) branch June 11, 2021 13:03
SiriousHunter pushed a commit to SiriousHunter/astro that referenced this pull request Feb 3, 2023
* Remove second snowpack instance

* Document import.meta.env.SSR

* Remove unnecessary Promise.all
ematipico pushed a commit that referenced this pull request Feb 5, 2025
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
ematipico pushed a commit that referenced this pull request Feb 5, 2025
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
ematipico pushed a commit that referenced this pull request Feb 6, 2025
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
ematipico pushed a commit that referenced this pull request Feb 6, 2025
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
ematipico pushed a commit that referenced this pull request Feb 7, 2025
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
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