includeFiles in build vercel.json #9069
-
|
i want |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
For your case you shouldn't need import fs from 'fs';
const keys = JSON.parse(fs.readFileSync(__dirname + '/keys.json'));
export default (req, res) => { … }To answer your original question though, {
"builds": [
{
"src": "api/*.js",
"use": "@vercel/node",
"config": {
"includeFiles": [ "keys.json" ]
}
}
]
}Note that you can also achieve similar with the Hope that helps. Cheers! |
Beta Was this translation helpful? Give feedback.
For your case you shouldn't need
includeFiles, since the bundler will automatically notice that you are using that file and bundle it into the Serverless Function implicitly. Be sure to usefs.readFileSync()or similar to trigger the bundling mechanism, something like:To answer your original question though,
includeFilesproperty belongs in theconfigobject with thebuildsarray. So something like:{ "builds": [ { "src": "api/*.js", "use": "@vercel/node", "config": { "includeFiles": [ "keys.json" ] } } ] }Note that you…