-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
I use webpack 4.25.0 to bundle mongodb 3.2.7 into a node.js 10.16.0 app. The bundle works fine, but each time I build I have to see these warnings:
WARNING in ./node_modules/require_optional/index.js 82:18-42
Critical dependency: the request of a dependency is an expression
@ ./node_modules/mongodb-core/index.js
@ ./node_modules/mongodb/index.js
@ ./src/utility/mongo.mjs
@ ./src/server.js
WARNING in ./node_modules/require_optional/index.js 90:20-44
Critical dependency: the request of a dependency is an expression
@ ./node_modules/mongodb-core/index.js
@ ./node_modules/mongodb/index.js
@ ./src/utility/mongo.mjs
@ ./src/server.js
WARNING in ./node_modules/require_optional/index.js 97:35-67
Critical dependency: the request of a dependency is an expression
@ ./node_modules/mongodb-core/index.js
@ ./node_modules/mongodb/index.js
@ ./src/utility/mongo.mjs
@ ./src/server.js
This may have something to do with the fact that I use Ecmascript Modules instead of Common.js modules to import the mongodb package; my mongo.mjs file starts like this:
import { default as mongodb } from 'mongodb';
const MongoClient = mongodb.MongoClient;
To avoid seeing these warnings on every build, I've added an object to my webpack.config.js file that looks like this:
let wp = {}; wp.stats = {}; wp.stats.warningsFilter = (warning)=>
{
let aryModulesToBlockWarningsFrom =
[
"node_modules/require_optional/index.js"
];
let block = false;
aryModulesToBlockWarningsFrom.forEach((modulePath)=>
{
if(RegExp(modulePath).test(warning) === true)
{
block = true;
}
});
return block;
};
However, I was hoping that the require_optional developers might be able to enhance their code in a way it would still work great but just not produce these warning upon bundling mongodb.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels