vercel / vercel/ncc

Display WebPack's warnings

Open
#400 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
9.8k
Forks
326
PR merge metrics
No merged PRs in 30d

Description

If I try to bundle the following code:

const importLazy = require("import-lazy")(require);
const lodash = importLazy("lodash");
console.log ( lodash );

With webpack (v4.4.1) directly I get a warning saying:

WARNING in ./index.js
1:42-49 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
 @ ./index.js

Basically the way lodash is being imported is too dynamic for WebPack and this file can't be bundled properly.

If I try to bundle it with ncc I get 0 warnings, so I may think the thing worked while in fact it produced a broken bundle.

All warnings and errors from WebPack should be displayed.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the example from index.js by comparing ncc's output with webpack v4.4.1, especially the dynamic require warning shown in the issue. Trace how ncc handles webpack warnings and errors; done means all relevant webpack warnings and errors are surfaced instead of producing a silent, broken bundle.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, webpack
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.