-
Notifications
You must be signed in to change notification settings - Fork 417
pg-native - How to bundle? #78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I'll soon work on a peace of software which uses
And the files are:
|
Perfect, thanks. |
While pg-promise fully supports pg-native, the real performance gain is negligible, especially under the new versions of Node.js |
Another solution (if using webpack), is to add
|
For those experiencing this using You can check the diff at https://github.com/aychtang/serverless-bundle. I will not be maintaining this so it will stay at the current version of serverless-bundle, but I thought it'd be useful to share if people are doing some small projects and want to save some time. TLDR:
|
Just came across this, if you're using custom:
bundle:
ignorePackages:
- pg-native |
that works for me, thanks |
If you are using Webpack 5 the API of const { IgnorePlugin } = require('webpack');
module.exports = {
plugins: [
new IgnorePlugin({
resourceRegExp: /^pg-native$/,
}),
],
}; |
Thanks @getkey. It worked ! |
Thanks. Saved my day |
If you are using custom:
esbuild:
exclude:
- pg-native See: https://www.npmjs.com/package/serverless-esbuild#configuration |
You're the best! Thank you! |
Importing
pg.Client
viavar Client = require('pg').Client;
throws the following error:How can i fix this? I found the following somewhat related Issues/answers
System-Info:
.babelrc
{
"plugins": ["transform-runtime"],
"presets": ["es2015", "stage-0"],
"ignore": [
"node_modules/pg/lib/native/",
"node_modules/pg/lib/native/index.js",
"node_modules/pg/lib/native/result.js",
"node_modules/pg/lib/native/query.js",
"./node_modules/pg/lib/native/",
"./node_modules/pg/lib/native/index.js",
"./node_modules/pg/lib/native/result.js",
"./node_modules/pg/lib/native/query.js",
"~/pg/lib/native/index.js",
"node_modules/pg/",
"node_modules/pg/",
"./node_modules/pg/",
"./node_modules/pg/",
"./node_modules/pg/"
]
}
webpack.config.js
Sames as in https://github.com/elastic-coders/serverless-webpack/blob/master/examples/babel/webpack.config.js
The text was updated successfully, but these errors were encountered: