oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
73.44k stars 2.7k forks source link

`bunx --bun vite build` throw undefined error in docker image build in github actions in sveltekit project #10811

Closed IslamZaoui closed 4 months ago

IslamZaoui commented 4 months ago

What version of Bun is running?

1.1.7

What platform is your computer?

windows

What steps can reproduce the bug?

building my Sveltekit project for production on my local machine works fine but when I commit my change and github build it it causes an undefined

What is the expected behavior?

to build successfully

What do you see instead?

image

Additional information

this happened randomly, between 2 commits nothing really changes

IslamZaoui commented 4 months ago

this my dockerfile:

FROM oven/bun:1.1 as base

ENV PUBLIC_POCKETBASE_URL=http://db:8080
ENV ORIGIN=http://localhost:3000

WORKDIR /usr/src/app

# install dependencies into temp directory
# this will cache them and speed up future builds
FROM base AS install
RUN mkdir -p /temp/dev
COPY package.json bun.lockb /temp/dev/
RUN cd /temp/dev && bun install --frozen-lockfile

# install with --production (exclude devDependencies)
RUN mkdir -p /temp/prod
COPY package.json bun.lockb /temp/prod/
RUN cd /temp/prod && bun install --frozen-lockfile --production

# copy node_modules from temp directory
# then copy all (non-ignored) project files into the image
FROM base AS prerelease
COPY --from=install /temp/dev/node_modules node_modules
COPY . .

# tests & build
ENV NODE_ENV=production
RUN bun run build -- --debug

# copy production dependencies and source code into final image
FROM base AS release
COPY --from=install /temp/prod/node_modules node_modules
COPY --from=prerelease /usr/src/app/build .
COPY --from=prerelease /usr/src/app/package.json .

# run the app
EXPOSE 3000
CMD ["bun", "run", "/usr/src/app/index.js"]
danknessdra commented 4 months ago

same issue

IslamZaoui commented 4 months ago

I found out that this error is related to svelte-adapter-bun and an import with the wrong letter case. when I switched to the node adapter the error appeared and I fixed it