node-config icon indicating copy to clipboard operation
node-config copied to clipboard

warning `Critical dependency: the request of a dependency is an expression` when build with webpack

Open windsome opened this issue 3 years ago • 1 comments

there is a warning build with webpack.

WARNING in ../../node_modules/config/parser.js 190:11-28
Critical dependency: the request of a dependency is an expression
 @ ../../node_modules/config/lib/config.js 10:13-33
 @ ./src/index.js 5:85-112 6:313-323

the problem is at lib/config.js: 584

  NODE_CONFIG_PARSER = util.initParam('NODE_CONFIG_PARSER');
  if (NODE_CONFIG_PARSER) {
    try {
      var parserModule = Path.isAbsolute(NODE_CONFIG_PARSER)
        ? NODE_CONFIG_PARSER
        : Path.join(CONFIG_DIR, NODE_CONFIG_PARSER);
      Parser = require(parserModule);
    }
    catch (e) {
      console.warn('Failed to load config parser from ' + NODE_CONFIG_PARSER);
      console.log(e);
    }
  }

maybe need change require(parserModule) torequire(${parserModule})?

windsome avatar Aug 01 '22 10:08 windsome

Did you search the issues for webpack and review the other webpack issues before adding a new one?

markstos avatar Aug 01 '22 14:08 markstos

Closing due to lack of interest and follow-up. The node-config maintainers don't use webpack. No one else has contributed a PR for this or commented in about a year, so it does not seem to a priority for nearly all users. If someone wants to submit a PR to improve webpack support, feel free.

markstos avatar Aug 04 '23 02:08 markstos