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: timestamp config dynamicImport #13502

Merged
merged 1 commit into from Jun 13, 2023

Conversation

patak-dev
Copy link
Member

@patak-dev patak-dev commented Jun 13, 2023

Description

SvelteKit is failing after #13269, as config.build.ssr is mutated then the object is cached by Node. This PR makes sure the dynamic import config module is always different by adding a timestamp.


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

@stackblitz
Copy link

stackblitz bot commented Jun 13, 2023

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

@patak-dev
Copy link
Member Author

/ecosystem-ci run sveltekit

@vite-ecosystem-ci
Copy link

vite-ecosystem-ci bot commented Jun 13, 2023

📝 Ran ecosystem CI: Open

suite result
sveltekit ✅ success

Comment on lines +1154 to +1156
Buffer.from(`${bundledCode}\n//${configTimestamp}`).toString(
'base64',
),
Copy link
Member

@bluwy bluwy Jun 13, 2023

Choose a reason for hiding this comment

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

I wonder if this would affect sourcemaps since we're bundling with esbuild with sourcemap: 'inline', but I'm also not sure if we're using the sourcemap in anyway 🤔

Other than that this looks good to me though, nice find with the issue! I also wonder if doing a { ...config } would also fix the issue if it's an object. (Actually I think we'd need a deep clone)

Copy link
Member Author

Choose a reason for hiding this comment

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

Ya, I also thought of trying to do a deep clone. Or reviewing our code to avoid modifying the config somehow. But doing a new import here seems safer. The config could have side effects like a variable with a timestamp that won't be unique per config. State could be shared if they are defined as global for example.

@patak-dev patak-dev added the p3-minor-bug An edge case that only affects very specific usage (priority) label Jun 13, 2023
@patak-dev patak-dev merged commit 6a87c65 into main Jun 13, 2023
21 checks passed
@patak-dev patak-dev deleted the fix/timestamp-config-dynamic-import branch June 13, 2023 15:01
patak-dev added a commit that referenced this pull request Jul 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants