Skip to content
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

fix(NODE-6731): fix and test webpack bundling #71

Merged
merged 1 commit into from
Feb 10, 2025
Merged

Conversation

durran
Copy link
Member

@durran durran commented Feb 10, 2025

Description

Fixes Webpack bundling and adds tests.

What is changing?

  • Fixes the require to be able to be bundled by wekbpack and adds tests.
Is there new documentation needed for these changes?

None

> $ npm run build                                                                                          ⬡ 20.17.0 [±main ●●]

> [email protected] build
> webpack --mode=production --node-env=production

asset 929a305a4fb721c45c0ff49c0e5965c6.node 1.4 MiB [emitted] (auxiliary name: main)
asset main.js 1.31 KiB [emitted] [minimized] (name: main)
runtime modules 150 bytes 2 modules
built modules 1.8 KiB [built]
  cacheable modules 1.68 KiB
    ./src/index.js 75 bytes [built] [code generated]
    ./node_modules/@mongodb-js/zstd/lib/index.js 1.41 KiB [built] [code generated]
    ./node_modules/@mongodb-js/zstd/build/Release/zstd.node 197 bytes [built] [code generated]
  external "util" 42 bytes [built] [code generated]
  external "util/types" 42 bytes [built] [code generated]
  external "path" 42 bytes [optional] [built] [code generated]

WARNING in ./node_modules/@mongodb-js/zstd/lib/index.js 13:13-48
Module not found: Error: Can't resolve '../build/Debug/zstd.node' in '/Users/modetojoy/work/mongodb-js/zstd/test/bundling/webpack/node_modules/@mongodb-js/zstd/lib'
 @ ./src/index.js 2:13-40

1 warning has detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.

webpack 5.97.1 compiled with 1 warning in 193 ms

What is the motivation for this change?

NODE-6731

Release Highlight

Package is now compatible with Webpack

In order to use this module when bundling with Webpack, please include in your webpack.config.js:

  target: 'node',
  module: {
    rules: [
      {
        test: /\.node$/i,
        loader: 'node-loader'
      }
    ]
  }

Double check the following

  • Ran npm run format:js && npm run format:rs script
  • Self-review completed using the steps outlined here
  • PR title follows the correct format: type(NODE-xxxx)[!]: description
    • Example: feat(NODE-1234)!: rewriting everything in coffeescript
  • Changes are covered by tests
  • New TODOs have a related JIRA ticket

@durran durran marked this pull request as ready for review February 10, 2025 20:32
@durran durran requested a review from a team as a code owner February 10, 2025 20:32
@baileympearson baileympearson self-assigned this Feb 10, 2025
@baileympearson baileympearson added the Primary Review In Review with primary reviewer, not yet ready for team's eyes label Feb 10, 2025
@baileympearson baileympearson added Team Review Needs review from team and removed Primary Review In Review with primary reviewer, not yet ready for team's eyes labels Feb 10, 2025
@baileympearson baileympearson merged commit 94449cf into main Feb 10, 2025
33 of 38 checks passed
@baileympearson baileympearson deleted the NODE-6731 branch February 10, 2025 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team Review Needs review from team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants