-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Description
Just dropping a note here because I spent a few hours on this :)
I was attempting to bundle pg using rollup for deployment into a lambda function. While the bundling process would work when I attempted to run my server I'd get an error along the line of
Error: Cannot find module 'pg-native'
I ended up resolving the issue by specifying a couple of ignores with rollup-plugin-commonjs. My complete rollup config looked something like
import json from 'rollup-plugin-json'
import resolve from 'rollup-plugin-node-resolve'
import commonjs from 'rollup-plugin-commonjs'
export default {
input: 'src.js',
output: {
file: 'output.js',
format: 'cjs'
},
plugins: [
resolve(),
commonjs({
include: 'node_modules/**',
ignore: ['pg-native' , './native'] <---- the critical lines
})
]
}
I took my lead from these lines with pg which suggest that the require(./native) leads to the inclusion of the require(pg-native)
Hope this helps somebody else one day :)
Thanks for a super library!
ChrisKitching, AntoineCheron, dude333, FlamingTempura, charsleysa and 4 more
Metadata
Metadata
Assignees
Labels
No labels