Skip to content

chore(dev-deps): update eslint, prettier, vitest #333

New issue

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

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

Already on GitHub? # to your account

Merged
merged 10 commits into from
Sep 17, 2024

Conversation

AriPerkkio
Copy link
Member

  • chore(dev-deps): update @blitz/eslint-plugin
  • chore(dev-deps): update eslint-plugin-astro
  • chore(dev-deps): update prettier packages
  • chore(dev-deps): update vitest
  • chore(dev-deps): remove vite-plugin-inspect

Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@AriPerkkio AriPerkkio requested a review from Nemikolh September 16, 2024 12:31
@Nemikolh
Copy link
Member

Nice! You also need to update the build.js script:

define: {
'process.env.TUTORIALKIT_DEV': JSON.stringify(process.env.TUTORIALKIT_DEV ?? null),
},

This should be:

    define: {
      'process.env.TUTORIALKIT_DEV': JSON.stringify(process.env.TUTORIALKIT_DEV ?? null),
      'process.env.VITE_INSPECT': JSON.stringify(process.env.VITE_INSPECT ?? null),
    },

Also wondering if we should call it TUTORIALKIT_VITE_INSPECT. Thoughts?

@AriPerkkio
Copy link
Member Author

Nice! You also need to update the build.js script:

Interesting way of using Vite's define - it overrides process.env.<var> from environment variables. I guess this is so that you cannot use these environment variables after build?

Another interesting note: this is what dead-code-elimination does to this line. I guess there's some edge case why it has to leave await there too:

- process.env.TUTORIALKIT_DEV ? (await import('vite-plugin-inspect')).default() : null,
+ null ? (await null).default() : null

https://unpkg.com/browse/@tutorialkit/astro@0.2.3/dist/index.js

@Nemikolh
Copy link
Member

Oh that's an odd one!

I've been trying to get esbuild to generate the same thing in their playground but failed. 😮

See this esbuild playground link.

It always eliminate the await, even with minify: false which is what we do for Astro. 🤔

@Nemikolh
Copy link
Member

Interesting way of using Vite's define - it overrides process.env.<var> from environment variables. I guess this is so that you cannot use these environment variables after build?

Btw, this is not using vite, we use esbuild directly for our Astro integration. And yes, the idea is that those environment variable cannot be used after a build.

We do this because vite-inspect-plugin is a dev dependency of our Astro integration. So the the dynamic import would (always?) fail for our end users if they had those env vars defined by accident.

Copy link
Member

@Nemikolh Nemikolh left a comment

Choose a reason for hiding this comment

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

Nice! Let's merge this 🙌

@Nemikolh Nemikolh merged commit 5e5c60e into stackblitz:main Sep 17, 2024
10 checks passed
@AriPerkkio AriPerkkio deleted the chore/update-eslint-plugins branch September 17, 2024 14:29
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants