Skip to content
This repository has been archived by the owner on Jul 9, 2024. It is now read-only.

Webpack warning: 'Map' was not found in 'bson' #159

Open
thomas-jakemeyn opened this issue Mar 1, 2023 · 1 comment
Open

Webpack warning: 'Map' was not found in 'bson' #159

thomas-jakemeyn opened this issue Mar 1, 2023 · 1 comment

Comments

@thomas-jakemeyn
Copy link

I use ejson-shell-parser : 1.2.2 together with bson : 5.0.1 (aka the latest versions at the time of writing this issue). When I bundle my application with Webpack, I do get the following warning:

WARNING in ./node_modules/ejson-shell-parser/dist/ejson-shell-parser.esm.js 177:25-33
export 'Map' (imported as 'bson') was not found in 'bson' (possible exports: BSON, BSONError, BSONRegExp, BSONRuntimeError, BSONSymbol, BSONType, BSONValue, BSONVersionError, Binary, Code, DBRef, Decimal128, Double, EJSON, Int32, Long, MaxKey, MinKey, ObjectId, Timestamp, UUID, calculateObjectSize, deserialize, deserializeStream, serialize, serializeWithBufferAndIndex, setInternalBufferSize)

The export of Map from bson has been removed in the release 5.0.0 (see NODE-4712 in the release notes).

esjson-shell-parser is supposed to be compatible with bson 5 since the release 1.2.1 (see this PR). Unfortunately, this change seems to be the one triggering a warning during the Webpack build.

@thomas-jakemeyn thomas-jakemeyn changed the title Webpack warning: 'Map' was not found in 'bson'. Webpack warning: 'Map' was not found in 'bson' Mar 1, 2023
@thomas-jakemeyn
Copy link
Author

The only workaround I found so far is to fallback to the CommonJS version using Webpack Resolve:

config.resolve.alias = {
  'ejson-shell-parser': path.join(ROOT_DIR, 'node_modules', 'ejson-shell-parser', 'dist', 'ejson-shell-parser.cjs.js'),
};

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant