Tyler Flint
10/04/2021, 5:32 PMError: Cannot find the esbuild config file at "/Users/tylerflint/Code/tylerflint/serverless-app-template/Users/tylerflint/Code/tylerflint/serverless-app-template/config/esbuild.js"
Tyler Flint
10/04/2021, 5:33 PMesbuildConfig: {
plugins: "config/esbuild.js"
}
Tyler Flint
10/04/2021, 5:34 PMTyler Flint
10/04/2021, 5:35 PMTyler Flint
10/04/2021, 5:35 PM// Validate custom esbuild plugins path
if (customConfig && customConfig.plugins) {
customConfig.plugins = path.join(appPath, customConfig.plugins);
if (!fs.existsSync(customConfig.plugins)) {
throw new Error(
`Cannot find the esbuild config file at "${customConfig.plugins}"`
);
}
}
Tyler Flint
10/04/2021, 5:36 PMcustomConfig.plugins
must get changed somewhere to the full path, which works on the first run, but on the second run it tries to concatenate again which creates a non-existent paththdxr
10/04/2021, 5:38 PMTyler Flint
10/04/2021, 5:38 PMTyler Flint
10/04/2021, 5:39 PMcustomConfig.plugins = path.join(appPath, customConfig.plugins);
Tyler Flint
10/04/2021, 5:39 PMpath.join
Tyler Flint
10/04/2021, 5:39 PMthdxr
10/04/2021, 5:40 PMthdxr
10/04/2021, 5:40 PMthdxr
10/04/2021, 5:41 PMlet customConfig = appEsbuildConfig || bundle.esbuildConfig || {};
Quick fix would be to deep clone hereTyler Flint
10/04/2021, 5:41 PMBuilding Lambda function src/lambda/graphql.main
Before: config/esbuild.js
After: /Users/tylerflint/Code/tylerflint/serverless-app-template/config/esbuild.js
Building Lambda function src/lambda/web.main
Before: /Users/tylerflint/Code/tylerflint/serverless-app-template/config/esbuild.js
After: /Users/tylerflint/Code/tylerflint/serverless-app-template/Users/tylerflint/Code/tylerflint/serverless-app-template/config/esbuild.js
thdxr
10/04/2021, 5:46 PMthdxr
10/04/2021, 5:46 PMTyler Flint
10/04/2021, 5:46 PMTyler Flint
10/04/2021, 5:46 PMthdxr
10/04/2021, 5:47 PMTyler Flint
10/04/2021, 5:47 PMthdxr
10/04/2021, 5:47 PMTyler Flint
10/04/2021, 5:47 PMthdxr
10/04/2021, 5:48 PMTyler Flint
10/04/2021, 5:48 PMthdxr
10/04/2021, 5:48 PMthis.setDefaultFunctionProps
in the stackTyler Flint
10/04/2021, 5:48 PMthdxr
10/04/2021, 5:48 PMTyler Flint
10/04/2021, 5:48 PMTyler Flint
10/04/2021, 5:52 PMsst.json
configuration, and not the function definitionTyler Flint
10/04/2021, 5:52 PMsst.json
config and only using the function definition and that didn’t seem to workthdxr
10/04/2021, 5:52 PMTyler Flint
10/04/2021, 5:52 PMthdxr
10/04/2021, 5:53 PMthdxr
10/04/2021, 6:23 PMTyler Flint
10/04/2021, 6:27 PMTyler Flint
10/04/2021, 6:29 PMTyler Flint
10/04/2021, 6:29 PMTyler Flint
10/04/2021, 6:29 PMthdxr
10/04/2021, 6:30 PM./node_modules/@serverless-stack/resources/package.json
thdxr
10/04/2021, 6:30 PMTyler Flint
10/04/2021, 6:30 PM0.43.10-next.19+1e86a933
Tyler Flint
10/04/2021, 6:31 PMif (customConfig && customConfig.plugins) {
customConfig.plugins = path.join(appPath, customConfig.plugins);
if (!fs.existsSync(customConfig.plugins)) {
throw new Error(
`Cannot find the esbuild config file at "${customConfig.plugins}"`
);
}
}
Frank
It looks like it’s pulling that from theIsconfiguration, and not the function definitionsst.json
esbuildConfig
set both in the sst.json
and the Functions’s props?Tyler Flint
10/05/2021, 2:26 PMsst.json
and see if that works…Tyler Flint
10/05/2021, 2:30 PMTyler Flint
10/05/2021, 2:31 PMsst.json
Tyler Flint
10/05/2021, 2:33 PMTyler Flint
10/05/2021, 2:33 PMTyler Flint
10/05/2021, 2:54 PMTyler Flint
10/05/2021, 2:55 PMthdxr
10/05/2021, 2:55 PMTyler Flint
10/05/2021, 3:05 PMthdxr
10/05/2021, 3:05 PMthdxr
10/05/2021, 3:06 PMTyler Flint
10/05/2021, 3:07 PMTyler Flint
10/05/2021, 3:08 PMthdxr
10/05/2021, 3:18 PMTyler Flint
10/05/2021, 3:44 PMFrank
esbuildConfig
setting in sst.json
. esbuildConfig
used to only take a string, but now it’s getting more complex with keepNames
, define
, and more to come. Maybe we should only allow defining it in FunctionProps?thdxr
10/06/2021, 4:48 AMFrank
esbuildConfig
in sst.json
from the Doc.