{"id":21506,"library":"koot-webpack","title":"Koot Webpack","description":"A webpack configuration generator specifically tailored for Koot.js applications, providing optimized setups for React SSR, SPA, and electron projects. Latest version 0.15.15 (released Feb 2024) with frequent minor updates. Key differentiators: built-in support for Qiankun micro-frontends, automatic SSR/SPA mode detection, and electron main process hot-reload. Targeted at Koot.js ecosystem users, not a general webpack utility.","status":"active","version":"0.15.15","language":"javascript","source_language":"en","source_url":"https://github.com/cmux/koot","tags":["javascript","webpack","koot"],"install":[{"cmd":"npm install koot-webpack","lang":"bash","label":"npm"},{"cmd":"yarn add koot-webpack","lang":"bash","label":"yarn"},{"cmd":"pnpm add koot-webpack","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package is ESM-only since v0.15; no CommonJS export available.","wrong":"const kootWebpack = require('koot-webpack')","symbol":"default","correct":"import kootWebpack from 'koot-webpack'"},{"note":"Named export for generating webpack config; ESM-only.","wrong":"const { getConfig } = require('koot-webpack')","symbol":"getConfig","correct":"import { getConfig } from 'koot-webpack'"},{"note":"Starts the development server with HMR; ESM-only.","symbol":"startDevServer","correct":"import { startDevServer } from 'koot-webpack'"}],"quickstart":{"code":"import { getConfig } from 'koot-webpack';\nimport webpack from 'webpack';\n\nconst config = getConfig({\n  mode: 'development',\n  projectPath: process.cwd(),\n  type: 'ssr', // or 'spa', 'electron'\n  env: { KEY: process.env.KEY ?? '' }\n});\n\nwebpack(config, (err, stats) => {\n  if (err) {\n    console.error(err);\n    return;\n  }\n  console.log(stats.toString({ colors: true }));\n});","lang":"typescript","description":"Generates a webpack configuration for a Koot.js SSR project and runs the build."},"warnings":[{"fix":"Use import instead of require(). If necessary, use dynamic import() in CommonJS.","message":"ESM-only since v0.15: CommonJS require() will fail with ERR_REQUIRE_ESM.","severity":"breaking","affected_versions":">=0.15.0"},{"fix":"Upgrade to webpack@5 and remove any webpack 4 specific loaders.","message":"Webpack 5 required as peer dependency. Using Webpack 4 will cause compatibility errors.","severity":"breaking","affected_versions":">=0.15.0"},{"fix":"Replace `templateInject` with `htmlPlugin` in your config.","message":"Option `templateInject` deprecated in v0.15.12; use `htmlPlugin` instead.","severity":"deprecated","affected_versions":">=0.15.12"},{"fix":"Use contextBridge to expose needed Node APIs to renderer processes.","message":"When using with Electron, target 'electron-renderer' is no longer set since v0.15.16. Node.js APIs may be unavailable.","severity":"gotcha","affected_versions":">=0.15.16"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Change require() to dynamic import() or set \"type\": \"module\" in package.json.","cause":"Package is ESM-only and cannot be imported with require() in vanilla Node.js.","error":"ERR_REQUIRE_ESM: require() of ES Module /path/to/koot-webpack/index.js from /path/to/project not supported."},{"fix":"Run `npm install webpack@5 --save-dev` to install it.","cause":"Webpack is a peer dependency but not installed.","error":"Module not found: Error: Can't resolve 'webpack'"},{"fix":"Use `import { getConfig } from 'koot-webpack'` instead of `const { getConfig } = require(...)`.","cause":"Incorrect import style; likely used require() when package is ESM-only.","error":"TypeError: getConfig is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}