Skip to content

Commit 6027f6a

Browse files
authored
chore(webpack, web): add saslprep no-op alias for webpack bundle web (#6911)
1 parent f9efb8a commit 6027f6a

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function saslprep(): void {
2+
throw new Error('saslprep is not supported in this environment');
3+
}

packages/compass-web/webpack.config.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ module.exports = (env, args) => {
4545
'@mongodb-js/devtools-proxy-support'
4646
),
4747

48+
...(config.mode === 'production'
49+
? {
50+
// We don't need saslprep in the product web bundle, as we don't use scram auth there.
51+
// We use a local polyfill for the driver to avoid having it in the bundle
52+
// as it is a decent size. We do use scram auth in tests and local
53+
// development, so we want it there.
54+
'@mongodb-js/saslprep': localPolyfill('@mongodb-js/saslprep'),
55+
}
56+
: {}),
57+
4858
// Replace 'devtools-connect' with a package that just directly connects
4959
// using the driver (= web-compatible driver) logic, because devtools-connect
5060
// contains a lot of logic that makes sense in a desktop application/CLI but
@@ -218,7 +228,7 @@ module.exports = (env, args) => {
218228
'react-dom': 'commonjs2 react-dom',
219229

220230
// TODO(CLOUDP-228421): move Socket implementation from mms codebase when
221-
// active work on the connumicatino protocol is wrapped up
231+
// active work on the communication protocol is wrapped up
222232
tls: 'commonjs2 tls',
223233
},
224234
plugins: [

0 commit comments

Comments
 (0)