Front-end build tools: npm, bundlers, Vite, webpack and transpiling – Front End interview prep

261 interview-style multiple-choice questions on Front-end build tools: npm, bundlers, Vite, webpack and transpiling, organized by topic: concepts, scenarios, code to read and tradeoffs, each with a short explanation. Learn the 52 key terms with the flashcards first, then test yourself.

Take the practice test · Flashcards · All study tools

What it covers

  1. 11.1 npm, package.json and dependencies
  2. 11.2 pnpm, Yarn, Bun and monorepo tooling
  3. 11.3 Module formats and package resolution
  4. 11.4 Bundling fundamentals
  5. 11.5 Vite
  6. 11.6 webpack, Rollup, esbuild and other bundlers
  7. 11.7 Transpiling, polyfills and browser targets
  8. 11.8 Linting, formatting and code quality
  9. 11.9 Builds in CI and production delivery

Key terms

11.1 npm, package.json and dependencies

package-lock.json
Lockfile recording exact dependency versions
Semantic versioning
MAJOR.MINOR.PATCH, where major marks breaking changes
devDependencies
Packages needed only for development and builds
npm ci
Clean, lockfile-exact install for CI
Caret range
^ allows minor and patch updates
Tilde range
~ allows patch updates only
peerDependencies
Packages the host app must provide
Transitive dependency
A dependency of a dependency

11.2 pnpm, Yarn, Bun and monorepo tooling

pnpm
Package manager with a content-addressable store
Phantom dependency
Imported but undeclared package
Corepack
Runs the pinned package manager version
Remote caching
Sharing task outputs across machines

11.3 Module formats and package resolution

exports field
Defines a package's public entry points
Dual package hazard
CJS and ESM copies loading twice
Bare specifier
Import like "react" with no path
Circular import
Modules importing each other

11.4 Bundling fundamentals

Bundler
Tool that combines modules into optimized output files
ES modules
Standard import/export modules with static structure
Minification
Shrinking code without changing its behavior
Source map
Maps built code back to the original source
Entry point
Module a bundler starts from
Scope hoisting
Concatenating modules into one scope
Externals
Imports left out of the bundle
Build manifest
Map from entries to hashed outputs

11.5 Vite

Vite
Dev server using native ES modules plus a Rollup-based production build
HMR
Hot Module Replacement: live module swaps without full reloads
Loader (webpack)
A transform applied to a file type during bundling
esbuild
Very fast Go-based bundler and transpiler
Dependency pre-bundling
Vite bundling node_modules with esbuild
Mode (Vite)
Named build mode choosing env files
import.meta.glob
Vite import of many files by pattern
Rolldown
Rust bundler compatible with Rollup

11.6 webpack, Rollup, esbuild and other bundlers

Module Federation
Runtime sharing of code across separate builds
Rspack
Rust bundler compatible with webpack
Turbopack
Rust bundler in Next.js
SWC
Rust compiler replacing Babel

11.7 Transpiling, polyfills and browser targets

Transpiler
Tool that rewrites code syntax for target environments
Polyfill
Runtime code that adds a missing API
ESLint
Linter for finding problems in JavaScript and TypeScript
Prettier
Opinionated code formatter
Ponyfill
Polyfill imported without patching globals
core-js
Polyfill library for JS built-ins
Baseline
Cross-browser support status for web features
Feature detection
Checking for an API before using it

11.8 Linting, formatting and code quality

Flat config
eslint.config.js array of configs
eslint-config-prettier
Disables ESLint rules that clash with Prettier
Biome
Rust formatter and linter
knip
Finds unused files, exports and deps

11.9 Builds in CI and production delivery

SPA fallback
Rewriting unknown paths to index.html
Runtime config
Settings loaded when the app starts
Preview deployment
Per-PR deploy with its own URL
Atomic deploy
Switching all files to a new build at once

Sample practice questions

  1. What is the purpose of `package-lock.json`?

    1. It stores the npm login credentials used for the project
    2. It stops anyone on the team from adding new dependencies
    3. It pins the exact version of every dependency, so installs repeat
    4. It lists only the packages you installed directly by name

    Answer: C. It pins the exact version of every dependency, so installs repeat Commit it; `npm ci` installs exactly what it lists.

  2. What is a monorepo workspace (npm, pnpm or Yarn workspaces)?

    1. Several packages in one repo, linked locally with one install
    2. A cloud IDE for editing and publishing npm packages
    3. A private npm registry hosted inside the company
    4. A folder at the repo root that holds only test files

    Answer: A. Several packages in one repo, linked locally with one install Workspaces link local packages so changes are picked up without publishing.

  3. What is the main difference between ES modules and CommonJS?

    1. ES modules use static `import`/`export`; CommonJS uses `require()`
    2. They're the same module system with different file extensions
    3. ES modules can't export functions, only values and classes
    4. CommonJS runs natively in browsers; ES modules need a bundler

    Answer: A. ES modules use static `import`/`export`; CommonJS uses `require()` Static structure is what makes tree shaking possible.

  4. What does a bundler such as webpack, Rollup or esbuild do?

    1. Compresses images on the server at request time
    2. Runs the app's server-side API in production
    3. Follows imports from an entry and combines modules into a few files
    4. Translates the app's HTML templates into JavaScript

    Answer: C. Follows imports from an entry and combines modules into a few files Bundlers also handle CSS, assets, code splitting and minification.

  5. Why does Vite's dev server start so fast compared with a classic webpack dev setup?

    1. It caches the whole app in the cloud and downloads it on startup
    2. It only supports plain HTML files, so there's nothing to compile
    3. It serves source as native ES modules on demand, without bundling first
    4. It skips JavaScript entirely and only serves HTML and CSS in development

    Answer: C. It serves source as native ES modules on demand, without bundling first Only the modules the browser actually requests are transformed.

  6. In webpack, what are loaders for?

    1. Loading environment variables from the server
    2. Speeding up network requests for chunks
    3. Loading the final bundle into the browser at runtime
    4. Transforming files like TypeScript or CSS into bundleable modules

    Answer: D. Transforming files like TypeScript or CSS into bundleable modules Plugins, by contrast, hook into the whole build, for example to generate HTML or extract CSS.

  7. What does a transpiler like Babel do?

    1. Converts JavaScript directly into machine code
    2. Formats the code to match a style guide
    3. Rewrites newer syntax, like JSX, into code targets can run
    4. Checks the code for type errors before it runs

    Answer: C. Rewrites newer syntax, like JSX, into code targets can run Transpilers rewrite syntax; missing built-in APIs need polyfills.

  8. What is the difference between ESLint and Prettier?

    1. ESLint runs in the browser; Prettier runs on the server
    2. Both are type checkers for TypeScript projects
    3. Prettier finds likely bugs; ESLint only reformats code
    4. ESLint finds likely bugs; Prettier only reformats code

    Answer: D. ESLint finds likely bugs; Prettier only reformats code Teams often run both, with ESLint's formatting rules turned off.

  9. Why run `tsc --noEmit` in CI when Vite already compiles the TypeScript?

    1. It uploads the type definitions to npm
    2. Vite strips types without checking them
    3. `tsc --noEmit` makes the bundle smaller
    4. Vite can't compile TypeScript files at all

    Answer: B. Vite strips types without checking them Type-checking and transpiling are separate steps in most modern toolchains.

  10. What does the version range `"^1.4.2"` allow npm to install?

    1. Any version from 1.4.2 up to, but not including, 2.0.0
    2. Any 1.4.x patch version from 1.4.2, but not 1.5.0
    3. Only version 1.4.2 exactly, and nothing newer than that
    4. Any version at all from 1.4.2 upward, including 2.0.0

    Answer: A. Any version from 1.4.2 up to, but not including, 2.0.0 `~1.4.2` is the tighter range: 1.4.2 up to, but not including, 1.5.0.

Practice all 261 questions

More Front End