Closed PierreCookie closed 4 years ago
Hey @PierreCookie I'm having the same issue here, were you able to work around it or fix it somehow?
I added the module inside my lib/apps in dependencies, like so it is downloaded, and switch to webpack.
Here's how you work around this:
import commonjs from 'rollup-plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import json from '@rollup/plugin-json';
export default {
input: 'index.js',
plugins: [
resolve(),
json(),
commonjs({ ignore: ['mongodb-client-encryption'] })
],
output: [{ file: 'dist/index.js', format: 'cjs', exports: 'named'}]
}
No way for Mongoose to work around this while supporting mongodb-client-encryption as an optional peer dependency using require()
. The only reason why rollup-plugin-commonjs
doesn't choke on kerberos and other optional peer dependencies is because those use require_optional, which we may move away from.
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
I want to bundle the package. But when i execute the script i have:
If the current behavior is a bug, please provide the steps to reproduce.
Create a file
index.js
:Try to bundle it with rollup:
rollup.config.js
Install the packages:
And insert the script in you package.json:
Run build
You should have a list of multiple error and the one that "need" to be resolved is mongodb-client-encryption.
Run the bundle
What is the expected behavior?
I want to be able to bundle my server, and to launch it with a commande like
node .
. I don't want to have an error due to unresolved dependencies.Maybe i should have the module in my package.json but as a user of your librairy i shouldn't do it.
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
node: v10.16.0 mongoose: 5.9.1 mongo: latest (3 month ago)