elysiajs / elysia-static

Plugin for Elysia for serving static folder
MIT License
12 stars 17 forks source link

Error when building #9

Open grctest opened 1 year ago

grctest commented 1 year ago
bun build ./src/index.tsx --outdir=dist

error: No matching export in "node:path" for import "resolve"
import { resolve, resolve as resolveFn, join } from 'path';         ^
/node_modules/@elysiajs/static/dist/index.js:2:10 54

error: No matching export in "node:path" for import "resolve"
import { resolve, resolve as resolveFn, join } from 'path';                  ^
/node_modules/@elysiajs/static/dist/index.js:2:19 63

error: No matching export in "node:path" for import "join"
import { resolve, resolve as resolveFn, join } from 'path';                                        ^
/node_modules/@elysiajs/static/dist/index.js:2:41 85

error: script "build" exited with code 1 (SIGHUP)

Likely related to the following bun issue: https://github.com/oven-sh/bun/issues/5095

heacsing commented 1 year ago

Thanks to your related information, I move the destructuring assignment to below and it works.

import path from path;
const { resolve, join } = path;
const resolveFn = resolve;

It's a practical solution before bun handle with that issue.