I have a stack defined in a package I import into ...
# sst
t
I have a stack defined in a package I import into my actual application. Routes that I define would use handlers that seem to require being specified by file path only. This means that when imported, it wants to go after a file location in the consuming app, not the location in the imported stack's package. Is there a way around this?
So far, my only solution seems to be to set the handler to be a path into node_modules to the src folder included in the package.
t
I have something similar and ended up doing this in the imported stack
Copy code
const root = this.node.root as <http://sst.App|sst.App>;
const { appPath } = root;
const dirname = path.relative(appPath, __dirname);
where
dirname
has the relative path from the app root to the stack definition inside
node_modules
from there you can add the path to the file with the function handler
t
@Tim I had re-posted in #help and there was a similar suggestion, but using some NodeJS functions:
Copy code
url.fileURLToPath(import.meta.url);
Perhaps this might be an alternative to your version, except yours already works, so is amazing.