@@ -16,23 +16,27 @@ const RELOCATABLE_BINARIES = [
16
16
]
17
17
18
18
/**
19
- * Sadly we need to manually patch the bundle because the default build doesn't work on Lambda .
19
+ * Manually patching the bundle to work around various incompatibilities in some versions .
20
20
*/
21
21
export const patchFile = async ( baseDir ) : Promise < void > => {
22
22
/* eslint-disable no-template-curly-in-string */
23
23
const replacements = [
24
- // Gatsby puts its cache db in a location that is readonly in functions
24
+ // Older versions of Gatsby put its cache db in a location that is readonly in functions
25
25
[
26
26
'process.cwd(), `.cache/${cacheDbFile}`' ,
27
27
"require('os').tmpdir(), 'gatsby', `.cache/${cacheDbFile}`" ,
28
28
] ,
29
- // If we're compiling on newer versions of Node, we need to use the binary that supports the older ABI version
29
+ // If we're compiling on newer versions of Node, we need to use the binary that supports the older ABI version because lambda
30
30
[
31
- 'Object.assign(exports, require(__webpack_require__.ab + "prebuilds/linux-x64/node.abi93.node"))' ,
32
- 'Object.assign(exports, require(__webpack_require__.ab + "prebuilds/linux-x64/node.abi83.node"))' ,
31
+ 'require(__webpack_require__.ab + "prebuilds/linux-x64/node.abi93.node")' ,
32
+ 'require(__webpack_require__.ab + "prebuilds/linux-x64/node.abi83.node")' ,
33
+ ] ,
34
+ // Newer versions of lmdb do this
35
+ [
36
+ 'require(__webpack_require__.ab + "prebuilds/linux-x64/node.abi93.glibc.node")' ,
37
+ 'require(__webpack_require__.ab + "prebuilds/linux-x64/node.abi83.glibc.node")' ,
33
38
] ,
34
39
]
35
-
36
40
/* eslint-enable no-template-curly-in-string */
37
41
38
42
const bundleFile = join ( baseDir , '.cache' , 'query-engine' , 'index.js' )
0 commit comments