Skip to content

Commit a390ca0

Browse files
committed
fix(NODE-6730): allow webpack bundling
1 parent 38e84d2 commit a390ca0

File tree

10 files changed

+8948
-1
lines changed

10 files changed

+8948
-1
lines changed

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function load() {
55
try {
66
return require('../build/Release/mongocrypt.node');
77
} catch {
8-
return require('../build/Debug/mongocrypt.node');
8+
console.error('Could not load the native module mongocrypt.node');
99
}
1010
}
1111

Binary file not shown.

test/bundling/webpack/dist/main.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/bundling/webpack/install_ce.cjs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
'use strict';
2+
3+
const { execSync } = require('node:child_process');
4+
const { readFileSync } = require('node:fs');
5+
const { resolve } = require('node:path');
6+
7+
const xtrace = (...args) => {
8+
console.log(`running: ${args[0]}`);
9+
return execSync(...args);
10+
};
11+
12+
const ceRoot = resolve(__dirname, '../../..');
13+
console.log(`mongodb-client-encryption package root: ${ceRoot}`);
14+
15+
const ceVersion = JSON.parse(
16+
readFileSync(resolve(ceRoot, 'package.json'), { encoding: 'utf8' })
17+
).version;
18+
console.log(`mongodb-client-encryption Version: ${ceVersion}`);
19+
20+
xtrace('npm pack --pack-destination test/bundling/webpack', { cwd: ceRoot });
21+
22+
xtrace(`npm install --no-save mongodb-client-encryption-${ceVersion}.tgz`);
23+
24+
console.log('mongodb-client-encryption installed!');

0 commit comments

Comments
 (0)