Skip to content

Commit 1058d0d

Browse files
authored
fix import.meta.url in hmr (oven-sh#21386)
### What does this PR do? <!-- **Please explain what your changes do**, example: --> use `window.location.origin` in browser instead of `bun://` . should fix [9910](oven-sh#19910) <!-- This adds a new flag --bail to bun test. When set, it will stop running tests after the first failure. This is useful for CI environments where you want to fail fast. --> - [ ] Documentation or TypeScript types (it's okay to leave the rest blank in this case) - [x] Code changes ### How did you verify your code works? <!-- **For code changes, please include automated tests**. Feel free to uncomment the line below --> <!-- I wrote automated tests --> <!-- If JavaScript/TypeScript modules or builtins changed: - [ ] I included a test for the new code, or existing tests cover it - [ ] I ran my tests locally and they pass (`bun-debug test test-file-name.test`) --> <!-- If Zig files changed: - [ ] I checked the lifetime of memory allocated to verify it's (1) freed and (2) only freed when it should be - [ ] I included a test for the new code, or an existing test covers it - [ ] JSValue used outside of the stack is either wrapped in a JSC.Strong or is JSValueProtect'ed - [ ] I wrote TypeScript/JavaScript tests and they pass locally (`bun-debug test test-file-name.test`) --> <!-- If new methods, getters, or setters were added to a publicly exposed class: - [ ] I added TypeScript types for the new methods, getters, or setters --> <!-- If dependencies in tests changed: - [ ] I made sure that specific versions of dependencies are used instead of ranged or tagged versions --> <!-- If a new builtin ESM/CJS module was added: - [ ] I updated Aliases in `module_loader.zig` to include the new module - [ ] I added a test that imports the module - [ ] I added a test that require() the module -->
1 parent 679a07c commit 1058d0d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/bake/hmr-module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export class HMRModule {
147147

148148
get importMeta() {
149149
const importMeta = {
150-
url: `bun://${this.id}`,
150+
url: `${location.origin}/${this.id}`,
151151
main: false,
152152
require: this.require.bind(this),
153153
// transpiler rewrites `import.meta.hot.*` to access `HMRModule.*`

0 commit comments

Comments
 (0)