How can I resolve bundle error with Hono and Bun in monorepo
Hi, could you please tell me how to resolve bundle error with Hono and Bun in monorepo?
What I want to do
I have created my own Web Components framework.
I want to import this framework in the test application with Hono.
Current situation
Current directory architecture is here:
- root
- packages: Web Components framework
- examples: test applications
This is monorepo architecture.
And I executed the following steps.
1. transpile packages and create JS files and d.ts files to
dist
directory in packages
2. load transpiled JS files in package.json
of examples directory as follows:
3. execute bun i
and check packages is existed in node_modules
4. move to examples directory
5. execute rm -rf dist && bunx tsc && bunx postcss src/**/*.css --dir dist && bun run --hot app.ts
6. check whether the architecture dist
directory in examples is correct
7. access to localhost
Error
The error Uncaught TypeError: Failed to resolve module specifier "[my framework]". Relative references must start with either "/", "./", or "../".
is occurred in browser console.
Upon checking JS files in dist, the pass has not been resolved.
How can I resolve it?🤔1 Reply
I resolved it by myself.
To compile TS to JS, I used
bunx tsc
in examples.
But, upon using the bun build
command, it was resolved.