{"id":18949,"library":"aem-clientlib-generator-webpack-plugin","title":"AEM ClientLib Generator Webpack Plugin","description":"Webpack plugin that integrates aem-clientlib-generator into your webpack build pipeline. It allows generation of AEM Client Libraries (clientlibs) from a single frontend source, supporting dependencies, embeds, and all clientlib properties via a configuration file (clientlib.config.js) or inline options. Version 1.0.0 is stable with moderate release cadence. Key differentiator: seamlessly combines the power of aem-clientlib-generator with webpack's compilation and asset processing, eliminating the need for separate build steps.","status":"active","version":"1.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/Cognifide/aem-clientlib-generator-webpack-plugin","tags":["javascript","aem","clientlib","clientlibs","generator","webpack","plugin"],"install":[{"cmd":"npm install aem-clientlib-generator-webpack-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add aem-clientlib-generator-webpack-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add aem-clientlib-generator-webpack-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core library for generating AEM Client Libraries","package":"aem-clientlib-generator","optional":false}],"imports":[{"note":"CommonJS only, as it's a webpack plugin; ESM import may fail due to lack of default export.","wrong":"import AemClientlibGeneratorPlugin from 'aem-clientlib-generator-webpack-plugin';","symbol":"AemClientlibGeneratorPlugin","correct":"const AemClientlibGeneratorPlugin = require('aem-clientlib-generator-webpack-plugin');"},{"note":"Package uses module.exports, so default import works in ESM, but named import does not.","wrong":"import { AemClientlibGeneratorPlugin } from 'aem-clientlib-generator-webpack-plugin';","symbol":"AemClientlibGeneratorPlugin (default import)","correct":"import AemClientlibGeneratorPlugin from 'aem-clientlib-generator-webpack-plugin';"},{"note":"If called with no arguments, it requires a clientlib.config.js file in the project root.","wrong":"new AemClientlibGeneratorPlugin() // without config and no clientlib.config.js found","symbol":"Plugin options","correct":"new AemClientlibGeneratorPlugin({ /* options */ })"}],"quickstart":{"code":"// webpack.config.js\nconst AemClientlibGeneratorPlugin = require('aem-clientlib-generator-webpack-plugin');\nconst path = require('path');\n\nmodule.exports = {\n  entry: './src/index.js',\n  output: {\n    path: path.resolve(__dirname, 'dist'),\n    filename: 'bundle.js'\n  },\n  plugins: [\n    new AemClientlibGeneratorPlugin({\n      // Options same as aem-clientlib-generator\n      basePath: 'dist',\n      clientLibRoot: path.resolve(__dirname, 'aem-clientlib'),\n      libs: {\n        name: 'mylib',\n        categories: ['mycategory'],\n        dependencies: ['jquery'],\n        jsProcessor: ['min:gcc'],\n        serialization: 'xml',\n        assets: {\n          js: ['bundle.js']\n        }\n      }\n    })\n  ]\n};","lang":"javascript","description":"Shows basic webpack configuration with the plugin, including client library definition with assets, dependencies, and serialization."},"warnings":[{"fix":"npm install aem-clientlib-generator","message":"Plugin requires aem-clientlib-generator to be installed as a dependency.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Provide options directly or create clientlib.config.js","message":"If no options passed, plugin looks for clientlib.config.js in the project root. If missing, it throws an error.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Double-check the option names against aem-clientlib-generator documentation.","message":"All options must be compatible with aem-clientlib-generator's schema. Mistyped option names cause silent failures.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"npm install aem-clientlib-generator --save-dev","cause":"Missing peer dependency aem-clientlib-generator","error":"Module not found: Can't resolve 'aem-clientlib-generator'"},{"fix":"Use 'const AemClientlibGeneratorPlugin = require('aem-clientlib-generator-webpack-plugin');' or 'import AemClientlibGeneratorPlugin from ...'","cause":"Incorrect import: using named import instead of default import in ES module context","error":"TypeError: AemClientlibGeneratorPlugin is not a constructor"},{"fix":"Create clientlib.config.js in project root or pass options object to the plugin.","cause":"No clientlib.config.js found in project root and no options provided","error":"Error: Cannot find module 'clientlib.config.js'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}