Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

fix(webpack): add global to new line #8226

Merged
merged 1 commit into from
Oct 16, 2022
Merged

fix(webpack): add global to new line #8226

merged 1 commit into from
Oct 16, 2022

Conversation

danielroe
Copy link
Member

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Previously we could end up with invalid JS and the following error:

[nuxt] [request error] [unhandled] [500] publicAssetsURL__webpack_public_path__ is not defined

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@danielroe danielroe added bug Something isn't working webpack πŸ”¨ p3-minor-bug Priority 3: a bug in an edge case that only affects very specific usage labels Oct 15, 2022
@danielroe danielroe requested a review from pi0 October 15, 2022 23:54
@danielroe danielroe self-assigned this Oct 15, 2022
@codesandbox
Copy link

codesandbox bot commented Oct 15, 2022

CodeSandbox logoCodeSandbox logoΒ  Open in CodeSandbox Web Editor | VS Code | VS Code Insiders

@netlify
Copy link

netlify bot commented Oct 15, 2022

βœ… Deploy Preview for nuxt3-docs canceled.

Name Link
πŸ”¨ Latest commit c1182af
πŸ” Latest deploy log https://app.netlify.com/sites/nuxt3-docs/deploys/634b483e6e6ca9000d5b0e04

@pi0 pi0 merged commit 5bf4461 into main Oct 16, 2022
@pi0 pi0 deleted the fix/webpack-newline branch October 16, 2022 09:03
@@ -21,7 +21,7 @@ export const DynamicBasePlugin = createUnplugin((options: DynamicBasePluginOptio
return
}
const s = new MagicString(code)
s.append(`${options.globalPublicPath} = buildAssetsURL();\n`)
s.append(`\n${options.globalPublicPath} = buildAssetsURL();\n`)
Copy link
Member

Choose a reason for hiding this comment

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

@antfu What do you think about supporting s.appendLine?

Copy link
Member

Choose a reason for hiding this comment

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

We didn't have the concept of line in MagicString, as all operations are index based. I am not sure if this complexity is necessary, giving the fix here is straightforward, while on the other hand we might end up introduce the xxxLine version for every magic string methods.

@pi0 pi0 mentioned this pull request Oct 18, 2022
@danielroe danielroe added the 3.x label Jan 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
3.x bug Something isn't working πŸ”¨ p3-minor-bug Priority 3: a bug in an edge case that only affects very specific usage webpack
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants