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
- 11.1 npm, package.json and dependencies
- 11.2 pnpm, Yarn, Bun and monorepo tooling
- 11.3 Module formats and package resolution
- 11.4 Bundling fundamentals
- 11.5 Vite
- 11.6 webpack, Rollup, esbuild and other bundlers
- 11.7 Transpiling, polyfills and browser targets
- 11.8 Linting, formatting and code quality
- 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
What is the purpose of `package-lock.json`?
- It stores the npm login credentials used for the project
- It stops anyone on the team from adding new dependencies
- It pins the exact version of every dependency, so installs repeat
- 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.
What is a monorepo workspace (npm, pnpm or Yarn workspaces)?
- Several packages in one repo, linked locally with one install
- A cloud IDE for editing and publishing npm packages
- A private npm registry hosted inside the company
- 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.
What is the main difference between ES modules and CommonJS?
- ES modules use static `import`/`export`; CommonJS uses `require()`
- They're the same module system with different file extensions
- ES modules can't export functions, only values and classes
- 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.
What does a bundler such as webpack, Rollup or esbuild do?
- Compresses images on the server at request time
- Runs the app's server-side API in production
- Follows imports from an entry and combines modules into a few files
- 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.
Why does Vite's dev server start so fast compared with a classic webpack dev setup?
- It caches the whole app in the cloud and downloads it on startup
- It only supports plain HTML files, so there's nothing to compile
- It serves source as native ES modules on demand, without bundling first
- 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.
In webpack, what are loaders for?
- Loading environment variables from the server
- Speeding up network requests for chunks
- Loading the final bundle into the browser at runtime
- 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.
What does a transpiler like Babel do?
- Converts JavaScript directly into machine code
- Formats the code to match a style guide
- Rewrites newer syntax, like JSX, into code targets can run
- 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.
What is the difference between ESLint and Prettier?
- ESLint runs in the browser; Prettier runs on the server
- Both are type checkers for TypeScript projects
- Prettier finds likely bugs; ESLint only reformats code
- 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.
Why run `tsc --noEmit` in CI when Vite already compiles the TypeScript?
- It uploads the type definitions to npm
- Vite strips types without checking them
- `tsc --noEmit` makes the bundle smaller
- 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.
What does the version range `"^1.4.2"` allow npm to install?
- Any version from 1.4.2 up to, but not including, 2.0.0
- Any 1.4.x patch version from 1.4.2, but not 1.5.0
- Only version 1.4.2 exactly, and nothing newer than that
- 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.
More Front End
- HTML semantics & accessibility
- CSS: box model, Flexbox, Grid
- JavaScript fundamentals
- Async JavaScript & the event loop
- TypeScript
- React: components, hooks & rendering
- State management: Redux, Zustand, context
- Angular and Vue basics
- Browser internals & rendering
- Web performance
- Front-end testing
- Front-end security
- Mobile & cross-platform