moodring
moodring2mo ago

"Complicated" dynamic import and deno bundle for the browser ..

I recently updated from 2.4 to 2.5, specifically for the new html entrypoint feature for the bundle command. Before upgrading, bundling ts/css to browser-ready output works fine. After upgrading, not only am I seeing several thousand chunks from bundled output, but also new errors in the browser console regarding missing .js files. Some diagnostic work shows the problem package to be browser-fs-access, which is a dependency of one of my direct dependencies, and the problem code to be dynamic imports, as in the following:
...
const o = e ? import("./file-save-745eba88.js") : import("./file-save-3189631c.js");
...
const o = e ? import("./file-save-745eba88.js") : import("./file-save-3189631c.js");
The errors in the browser look like the following:
index.mjs:10 GET http://localhost:9090/_.._/_.._/_.._/_.._/_.._/_.._/_.._/_.._/_.._/_.._/node_modules/.deno/browser-fs-access@0.29.1/node_modules/browser-fs-access/dist/file-open-002ab408-VZYZNU6I.js net::ERR_ABORTED 404 (Not Found)
(anonymous) @ index.mjs:10
index.mjs:10 GET http://localhost:9090/_.._/_.._/_.._/_.._/_.._/_.._/_.._/_.._/_.._/_.._/node_modules/.deno/browser-fs-access@0.29.1/node_modules/browser-fs-access/dist/file-open-002ab408-VZYZNU6I.js net::ERR_ABORTED 404 (Not Found)
(anonymous) @ index.mjs:10
Any guidance/help/tips are appreciated. Thanks!
1 Reply
moodring
moodringOP2mo ago
Update: This turned out to be an issue with the way denoServeDir resolves paths. Something about the /_.._/_.._/ etc in paths causes the method to 404 for these files. I haven't had a chance to do any further testing to build out a test case yet, but I plan to submit an issue later today. For the moment I'm rolling my own logic for path. lookup and serving with serveFile, which works great.

Did you find this page helpful?