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

feat(sveltekit): Read adapter output directory from svelte.config.js #7863

Merged
merged 2 commits into from
Apr 17, 2023

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Apr 14, 2023

Needs #7862

With this PR, our source maps upload plugin is able to read svelte.config.js. This is necessary to automatically find the output directory that users can specify when setting up the Node adapter.
This is a "little" hacky though, because we can't just access the output dir variable. Instead, we actually invoke the adapter (which we can access) and pass a minimal, mostly no-op adapter builder, which will report back the output directory.

(I'm sure this is gonna backfire some day but let's just do it anyway lol)

the good news:

closes #7669

@@ -37,7 +37,7 @@ const DEFAULT_PLUGIN_OPTIONS: SentrySvelteKitPluginOptions = {
* Sentry adds a few additional properties to your Vite config.
* Make sure, it is registered before the SvelteKit plugin.
*/
export function sentrySvelteKit(options: SentrySvelteKitPluginOptions = {}): Plugin[] {
export async function sentrySvelteKit(options: SentrySvelteKitPluginOptions = {}): Promise<Plugin[]> {
Copy link
Member Author

@Lms24 Lms24 Apr 14, 2023

Choose a reason for hiding this comment

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

This is technically breaking as it changes the return type of the function but the good news is that noone has to await this function as the vite config is perfectly fine with taking a Promise<Plugin[]>. I should have done this already but for some reason decided to stay sync in #7811. I vote we go forward with making it async, not just because we need it for this change but also because it gives us more freedom in the future.

Also, we're still in alpha, so yolo...

@Lms24 Lms24 requested review from a team, mydea and AbhiPrasad and removed request for a team April 14, 2023 15:06
@Lms24 Lms24 self-assigned this Apr 14, 2023
Copy link
Member

@AbhiPrasad AbhiPrasad left a comment

Choose a reason for hiding this comment

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

I'm fine with shipping this, but it means that that having an e2e test is a requirement for GA then.

@Lms24
Copy link
Member Author

Lms24 commented Apr 17, 2023

but it means that that having an e2e test is a requirement for GA then

Yeah this is a great point! We really should start thinking about E2E/Integration tests soon.

@Lms24 Lms24 force-pushed the lms/sveltekit-read-svelte-adapter-config branch from 1b221b2 to 0510596 Compare April 17, 2023 08:10
Base automatically changed from lms/sveltekit-bump-rollup-3 to develop April 17, 2023 08:29
@Lms24 Lms24 force-pushed the lms/sveltekit-read-svelte-adapter-config branch from 0510596 to 09891d8 Compare April 17, 2023 08:31
@Lms24 Lms24 merged commit 4b22708 into develop Apr 17, 2023
@Lms24 Lms24 deleted the lms/sveltekit-read-svelte-adapter-config branch April 17, 2023 08:50
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.

Upload source maps automatically in the SvelteKit SDK
2 participants