CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-confusing-browser-globals

A curated list of browser globals that commonly cause confusion and are not recommended to use without an explicit window qualifier

Overall
score

97%

Overview
Eval results
Files

task.mdevals/scenario-9/

Build Configuration Tool

A command-line tool that programmatically creates and manages webpack configurations for different environments.

Requirements

Create a CLI tool that generates webpack configuration objects for both development and production environments. The tool should be able to output these configurations in a format suitable for use with webpack.

Configuration Generation

The tool must support creating configurations for two distinct modes:

  • Development mode: Optimized for fast rebuilds and debugging
  • Production mode: Optimized for performance and bundle size

Development Configuration Features

  • Enable source maps for debugging
  • Set mode to 'development'
  • Configure devServer with hot module replacement enabled
  • Set devServer port to 3000
  • Enable devServer open browser functionality

Production Configuration Features

  • Disable source maps (or use a production-appropriate source map type)
  • Set mode to 'production'
  • Enable optimization features for code splitting
  • Configure filename with content hash for long-term caching

CLI Interface

The tool should accept a command-line argument to specify the environment:

node config-tool.js development
node config-tool.js production

The tool should output the webpack configuration as formatted JSON to the console.

Input Validation

  • Reject invalid environment values (only 'development' and 'production' should be accepted)
  • Provide clear error messages for invalid inputs

Test Cases

  • It generates valid development configuration with devServer settings @test
  • It generates valid production configuration with optimization settings @test
  • It rejects invalid environment arguments @test

@generates

API

/**
 * Creates a webpack configuration object for the specified environment
 * @param {string} env - The environment ('development' or 'production')
 * @returns {object} Webpack configuration object
 */
function createWebpackConfig(env) {
  // Implementation
}

module.exports = { createWebpackConfig };

Dependencies { .dependencies }

webpack { .dependency }

Provides module bundling and configuration infrastructure.

Install with Tessl CLI

npx tessl i tessl/npm-confusing-browser-globals

tile.json