Avoid `re2-wasm`
Opened this issue · 4 comments
While re2-wasm
is better than re2
, it still requires a trick to run with esbuild
that is commonly used by CDK constructs like:
CDK
This code works:
const main = new NodejsFunction(this, "MainFunction", {
entry: "./src/main.ts",
bundling: {
nodeModules: ["re2-wasm"],
},
});
Projen
https://projen.io/awscdk.html#aws-lambda-functions
No way to workaround as nodeModules
type of operation isn't supported yet.
It would be better to use only pure JS packages for SSDK libraries so that esbuild
can easily bundle all required files for AWS Lambda without extra effort.
In general, I agree; if there's a safe regex implementation in pure JS I'd love to switch to it.
Just curious: If I release a new module just inlining the re2-wasm
's WASM binary to avoid runtime file access, is it acceptable?
Assuming there's no licensing issues, I don't see a problem with that offhand.