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

fix: undefined viteServer #279

Merged
merged 1 commit into from Feb 27, 2023

Conversation

sand4rt
Copy link
Contributor

@sand4rt sand4rt commented Feb 24, 2023

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

Which package are you modifying?

  • vite-angular-plugin
  • astro-angular
  • create-analog
  • router
  • platform
  • content

What is the current behavior?

Build crashes when process.env['NODE_ENV'] === 'test' || !!process.env['VITEST'] is true and viteServer is undefined.

What is the new behavior?

The build won't crash when viteServer is undefined.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Exploring your repo about Playwright component testing and trying to avoid requiring users to install the Vite plugin and specify the tsconfig.

Hence i'm setting process.env['NODE_ENV'] environment variable to 'test' so that the Vite plugin can resolve this by it self: https://github.com/analogjs/analog/blob/main/packages/vite-plugin-angular/src/lib/angular-vite-plugin.ts#L53

The build will fail when i do this because viteServer will be undefined in this scenario.

Related to: microsoft/playwright#14153 (comment)

@netlify
Copy link

netlify bot commented Feb 24, 2023

Deploy Preview for analog-app ready!

Name Link
🔨 Latest commit 5787a5b
🔍 Latest deploy log https://app.netlify.com/sites/analog-app/deploys/63f8e96d0e51bd00089bba7d
😎 Deploy Preview https://deploy-preview-279--analog-app.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Feb 24, 2023

Deploy Preview for analog-docs ready!

Name Link
🔨 Latest commit 5787a5b
🔍 Latest deploy log https://app.netlify.com/sites/analog-docs/deploys/63f8e96db092bc0007d88bef
😎 Deploy Preview https://deploy-preview-279--analog-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@brandonroberts brandonroberts merged commit 301cffd into analogjs:main Feb 27, 2023
@brandonroberts
Copy link
Member

Thanks! @allcontributors add @sand4rt for code

@allcontributors
Copy link
Contributor

@brandonroberts

I've put up a pull request to add @sand4rt! 🎉

@brandonroberts
Copy link
Member

@sand4rt the fix has been published in @analogjs/vite-plugin-angular@0.2.0-alpha.28

@sand4rt
Copy link
Contributor Author

sand4rt commented Feb 27, 2023

@brandonroberts Awesome!

BTW, i integrated the plugin in this PR microsoft/playwright#21208. It does run a bit slower than the other frameworks but still acceptable in my opinion. If you have time, i'm very curious about what you think of it and whether you see things that could be improved.

Villanuevand pushed a commit to Villanuevand/analog that referenced this pull request Sep 12, 2023
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.

None yet

2 participants