is there any way in SST to include external files ...
# help
s
is there any way in SST to include external files in the local
.sst/artifacts/<hash>
folder? so for example.. I have a single Lambda handler right now, and that shows up in that folder as
src/lambda.js
. I’ve run a separate build process before running
yarn start
, and I want to have those resulting files copied into the same folder as the
lambda.js
file. is that doable?
t
Can you put them somewhere else and then use bundle.copyFiles
s
yes! probably? lemme try something
holy crap.. wow, did you guys expand the capabilities of
bundle
recently? there are hooks!
hmm, did I do this wrong?
Copy code
const api = new sst.Api(this, "Api", {
      routes: {
        $default: new sst.Function(this, "TestFunc", {
          handler: "src/lambda.handler",
          bundle: {
            copyFiles: [{ from: "dist", to: "." }],
          },
        }),
      },
    });
or will this only work on deploy, not
sst start
?
ok, I’m testing deployment for now I suppose. this didn’t work though:
Copy code
beforeBundling(inputDir, outputDir) {
                console.log("before:", inputDir, outputDir);
                return [
                  `yarn vite build --outDir ${outputDir} && ` +
                    `yarn vite build --ssr --outDir ${outputDir}`,
                ];
              },
it’s probably not a great idea to use
yarn
.. not sure of the proper way to run
node_modules/.bin/vite
the commands aren’t even firing off.. even a simple
echo hello
🤔
t
Let me look into this later today
s
sure, no rush. in the meantime, I can just run
yarn build:vite
separately
f
Just to chime in, the hooks and copyFiles aren’t being run in
sst start
mode
s
thanks. yeah, I realized that eventually. I’m trying to figure out a way to make this whole thing pretty seamless
still working on it!