sveltekit-adapter-lambda icon indicating copy to clipboard operation
sveltekit-adapter-lambda copied to clipboard

Missing manifest.js (Trying to build adapter-lambda myself for a fork)

Open JL102 opened this issue 2 years ago • 4 comments

Hi,

I've forked adapter-lambda because I'd like to implement a feature that would allow me to customize the Lambda handler code, but I'm unable to run the build script. It seems like esbuild is attempting to run serverless.js, which is searching for manifest.js, which does not exist. How do I get the build script to run properly?

> esbuild src/serverless.js --bundle --format=esm --platform=node --external:'../index.*' --external:'../manifest.*' --outfile=files/serverless.js && cp src/shims.js files/shims.js && cp src/router.js files/router.js

 > src/serverless.js:2:25: error: Could not resolve "../manifest.js"
    2 │ import { manifest } from '../manifest.js';
      ╵                          ~~~~~~~~~~~~~~~~

JL102 avatar Jan 21 '23 22:01 JL102

Hi @JL102 Thank You for your interest in my project! This is an odd one. I have cloned your fork of my repo and have run the command you have listed in your comment without issue. image I may be worth trying npm run build. This is the command that is run before a new version of the package is pushed to the NPM repository and again works on my machine with your fork. image

esbuild should be ignoring manifest.js (as it is with index.js) as they are marked as external in the esbuild arguments. Its a long shot but if you were trying to build on windows the way you input switches into a command may be slightly diffrent (if indeed you are using windows)

For some context, the above screenshot were taken using node 18.10.0 on Linux with esbuild 0.10.0

yarbsemaj avatar Jan 21 '23 23:01 yarbsemaj

@yarbsemaj Ah, that's it, thanks! I would switch to WSL, but due to very complicated reasons related to my Intel Arc GPU, I can't enable it until they update their driver with a bug fix. I created a new build script win-build that just adjusts the commands to work on Windows: https://github.com/yarbsemaj/sveltekit-adapter-lambda/compare/master...JL102:sveltekit-adapter-lambda:master Is it alright if I submit a PR with that?

Edit: Just noticed that package.json is using spaces instead of tabs. Are you using Bun? 😉

JL102 avatar Jan 22 '23 02:01 JL102

Aha! Glad you got there! :tada: Before i merge your change could you try using docker to perform the build. Id prefer not to have 2 build commands if i can help it.

yarbsemaj avatar Jan 22 '23 13:01 yarbsemaj

Unfortunately Docker needs hardware assisted virtualization to work, and SVM / Hyper-V is what I currently need to disable to get my Intel Arc GPU to work properly.

I updated the build script to work properly on both OSes -- turns out that the quotation marks are not needed. I tested on my laptop which runs Kubuntu. Is this solution acceptable? https://github.com/yarbsemaj/sveltekit-adapter-lambda/commit/2762ded0a6faa17f52d8ee34169f591be8f98acd

JL102 avatar Jan 22 '23 23:01 JL102