Comments (3)
@BeyondMagic text
does have a loader.
A possible workaround: start Bun with bun --loader=.html:text ./path.ts
from bun.
Hello, @Jarred-Sumner, you are right! Although I should have specified it better, using the text
loader in a custom plugin does not work! It gives the following error:
1 | (function (entry, parameters, fetcher)
^
error: Expected loader to be one of "js", "jsx", "object", "ts", "tsx", "toml", or "json"
at requestFetch (:1:21)
at requestInstantiate (:1:21)
at requestSatisfyUtil (:1:21)
1 | (function (entry, parameters, fetcher)
I have no desire not work on this, if you give a guidance to where to look at, I'll attempt to fix #5710.
A possible workaround: start Bun with bun --loader=.html:text ./path.ts
This works for loading the content of the HTML files as text and no need for a plugin! Thanks.
However, the issue at hand persists when using --hot
, if I save the file using a text editor, what happens is probably what you described here and Bun still crashes! Without debug, the following log is given and I have to force-exit the CLI:
error: Cannot find module "./page.html" from "/home/dream/projects/personal/wdwad/index.ts"
This seems rather trickier to solve, I tried adding std.time.sleep(5000000000);
in many HotReload
functions in the source-code, in loops of WatchList
for example, and still after the 500 milliseconds it still crashes! The problem seems to occur before, when it is signaled by inotify
of changes.
from bun.
Possible workarounds:
-
The problem can be mitigated in vim or neovim using
:set noswapfile
as shown by @brw. -
The problem can be further mitigated adding a delay of 50 miliseconds into the function reload of
/src/watcher.zig
and compiling thedebug
version.
diff --git a/src/watcher.zig b/src/watcher.zig
index 55d160ae9..61b70de14 100644
--- a/src/watcher.zig
+++ b/src/watcher.zig
@@ -128,6 +128,7 @@ pub const INotify = struct {
std.debug.assert(loaded_inotify);
restart: while (true) {
+ std.time.sleep(50000000);
Futex.wait(&watch_count, 0, null) catch unreachable;
const rc = std.os.system.read(
inotify_fd,
from bun.
Related Issues (20)
- @happy-dom causes Bun to hang forever on tests HOT 5
- Bun.build repeats the same imports several times when creating chunks
- `bun dist` should run `dist/index.js` like Node.js HOT 2
- twilio client hangs HOT 2
- Expected behavior of `describe` inside `describe.only`
- `bun add` help message inconsistent with actual `optional` option
- Permission issue, also bun --watch forgot reload the socket for e.g. HOT 4
- "ENOENT: No such file or directory" on fs.realpathSync(tmpdir()) HOT 6
- Buffer Import Error When Building for Client-Side with Bun HOT 1
- Bun on Termux HOT 2
- Setting Serve ca forces server to run as https (with no cert/key?) HOT 3
- Bun.file(1) FD corruption; GC bug? HOT 6
- Change bun r to run a script instead of bun remove HOT 1
- Install local tgz file, compatible with NPM and PNPM
- Implement 103 Early Hints HOT 1
- caret(`^version`) clobbers tilde(`~version`) in generated `yarn.lock`
- bun pack isn't a thing HOT 1
- stdin.pause/resume not working if there is a pause HOT 2
- Nyc does not work with Bun / `process.binding("spawn_sync")` is not implemented HOT 1
- Bun.stdin.stream() loses chunks in async iteration HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bun.