03 / 03

What are different available targets?

Difficulty: 5/10
target configuration, environment bundles, build output
A version of node or electron may be optionally specified. This is denoted by the [[X].Y] in the table above.
  1. 1

    node[[X].Y]

  2. 2

    node-webkit[[X].Y]

  3. 3

    nwjs[[X].Y]

  4. 4

    async-node[[X].Y]

  5. 5

    web

  6. 6

    webworker

  7. 7

    esX

  8. 8

    browserslist

  9. 9

    electron[[X].Y]-main

  10. 10

    electron[[X].Y]-renderer

  11. 11

    electron[[X].Y]-preload

Scenario Questions

0-2 years experience

  1. 1If you need to bundle a library that will run in both browsers and Node.js, which Webpack target would you choose and why?
  2. 2What happens if you set target to 'web' but your code uses Node's 'fs' module? How would Webpack handle that?

2-5 years experience

  1. 1You added a new worker script to a web app and the build started failing with 'module not found' errors. How would you adjust the Webpack target to fix it, and what trade‑offs does that introduce?
  2. 2During a migration to an Electron app, the main process bundle is unexpectedly pulling in browser polyfills. Which target should be configured, and how would you verify the change fixed the issue?

5-8 years experience

  1. 1Our monorepo builds both a server‑side rendering (SSR) bundle and a client bundle using the same Webpack config base. How would you structure the target settings to keep builds efficient and avoid duplication?
  2. 2We need to support a legacy Node.js version that doesn't understand ES modules. How would you configure Webpack targets and other settings to produce compatible output without sacrificing performance for the modern client bundle?

8+ years experience

  1. 1Across several teams, some services are deployed to AWS Lambda, others to a Kubernetes cluster, and a few to edge workers. How would you design a shared Webpack target strategy that balances build speed, bundle size, and runtime constraints for each environment?
  2. 2Your organization is moving from a Node.js backend to a serverless edge runtime (e.g., Cloudflare Workers). What architectural considerations around Webpack targets, polyfills, and module formats would you address to ensure a smooth migration and long‑term maintainability?

Follow-up Questions

  • How would you verify that the chosen target is actually being applied in the final bundle?
  • What effect does changing the target have on bundle size and polyfills?
  • Can you describe a situation where you had to override the default target for a specific entry?
Share

Share via WhatsApp, X, Facebook, LinkedIn or copy link. Open Graph preview enabled.