-
Notifications
You must be signed in to change notification settings - Fork 19
Comments
perf: use url to replace wasm module import#479
perf: use url to replace wasm module import #479fireairforce wants to merge 1 commit intoapt-oss:main from
Conversation
⚠️ No Changeset found
Latest commit: 154dd6b
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
sunshinesmilelk
commented
Dec 14, 2025
💖 Thanks for opening this pull request! 💖
Please follow the contributing guidelines. And we use [semantic commit messages to streamline the release process.
Examples of commit messages with semantic prefixes:
fix(ai-native): fix cursor in chatfeat(lab): support for julia script editing and previewdocs: add sql cell manual
Things that will help get your PR across the finish line:
- Follow the TypeScript, JavaScript, CSS and React coding style.
- Run
npm run lintlocally to catch formatting errors earlier. - Document any user-facing changes you've made.
- Include tests when adding/changing behavior.
- Include screenshots and animated GIFs whenever possible.
Please be patient and we will get back to you as soon as we can.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR replaces the module-based WASM import with a URL-based approach to improve bundle size and build speed. Instead of importing the WASM file as a module, it now fetches the oniguruma WASM file directly from unpkg.com CDN.
- Removes the module import of
vscode-oniguruma/release/onig.wasm - Uses a direct CDN URL to fetch the WASM file at runtime
- Simplifies the URL handling logic by removing conditional checks for different path formats
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Copilot
AI
Dec 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Creating a URL object from an absolute URL string is unnecessary overhead. The fetch() API accepts strings directly, so you can pass 'onigurumaPath' to fetch without wrapping it in a URL object first.
Copilot
AI
Dec 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a hardcoded external CDN URL (unpkg.com) may cause reliability issues in environments with restricted network access, offline scenarios, or if the CDN is unavailable. Consider making this URL configurable through an environment variable or configuration file, or bundling the WASM file as a fallback option.
Uh oh!
There was an error while loading. Please reload this page.
使用
new URL('')来替代 module import 去导入 wasm 产物,这样可以避免产物的 bundle 的体积 & 构建速度。用 webpack 测试过,看上去使用上效果都是一样的。