{"id":26076,"library":"pilet-webpack-plugin","title":"Pilet Webpack Plugin","description":"Webpack plugin for generating a valid pilet bundle as part of the Piral ecosystem. Current stable version 1.2.0 (released 2024) requires Node >=16 and webpack 4.x (peer dep). This plugin is the standard way to bundle pilets with Webpack v4. Unlike generic webpack configs, it sets up the specific output format, externals, and variable injection needed for pilets to work with a Piral shell. Ships TypeScript types. Part of the piral-cli toolchain; single repository was split from piral-cli-webpack. Older v0.x versions work with piral-core 0.15.","status":"active","version":"1.2.0","language":"javascript","source_language":"en","source_url":"https://github.com/smapiot/piral-cli-webpack","tags":["javascript","piral-cli","piral","plugin","webpack","command","typescript"],"install":[{"cmd":"npm install pilet-webpack-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add pilet-webpack-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add pilet-webpack-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency; plugin works with webpack 4.x only","package":"webpack","optional":false}],"imports":[{"note":"Named export, not default. CJS require({}) also fine; ESM available.","wrong":"const PiletWebpackPlugin = require('pilet-webpack-plugin')","symbol":"PiletWebpackPlugin","correct":"import { PiletWebpackPlugin } from 'pilet-webpack-plugin'"},{"note":"CommonJS destructure works; no default export exists.","wrong":"const PiletWebpackPlugin = require('pilet-webpack-plugin').default","symbol":"PiletWebpackPlugin","correct":"const { PiletWebpackPlugin } = require('pilet-webpack-plugin')"},{"note":"Type export available for TypeScript users.","wrong":null,"symbol":"PiletWebpackPluginOptions","correct":"import type { PiletWebpackPluginOptions } from 'pilet-webpack-plugin'"}],"quickstart":{"code":"const { PiletWebpackPlugin } = require('pilet-webpack-plugin');\nconst piletPkg = require('./package.json');\n\nmodule.exports = {\n  plugins: [\n    new PiletWebpackPlugin({\n      name: piletPkg.name,\n      version: piletPkg.version,\n      piral: piletPkg.piral.name,\n      variables: {\n        PIRAL_CLI_VERSION: require('piral-cli/package.json').version,\n      },\n    }),\n  ],\n};","lang":"javascript","description":"Shows how to add the PiletWebpackPlugin to a webpack 4 config with required options 'name', 'version', 'piral' and optional 'variables'."},"warnings":[{"fix":"Use pilet-webpack-plugin only with webpack 4. For webpack 5, use piral-cli-webpack5 or piral-cli-vite.","message":"Webpack 5 is NOT supported. Plugin only works with webpack 4.x peer dependency.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Set piral: piletPkg.piral.name from your pilet's package.json, which references the Piral shell name.","message":"The 'piral' option expects the name of the Piral instance (e.g., 'my-app-shell'), not the piral-cli package name.","severity":"gotcha","affected_versions":">=0.15.0"},{"fix":"Use the 'variables' option to inject additional defines; avoid duplicates.","message":"The plugin defines global variables via DefinePlugin. If you already use DefinePlugin, ensure no conflicts.","severity":"gotcha","affected_versions":">=0.15.0"},{"fix":"Update to pilet-webpack-plugin@1 and adjust options (name, version, piral).","message":"Older v0.x releases used a different API and output format. Migrate to v1.x for Piral 1.0 compatibility.","severity":"deprecated","affected_versions":"<1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Add piral: 'your-piral-instance-name' to the plugin options.","cause":"The piral option was not provided or is empty.","error":"Error: 'piral' is required"},{"fix":"Downgrade to webpack@4 or use a different bundler plugin like piral-cli-webpack5.","cause":"Using the plugin with webpack 5 instead of webpack 4.","error":"TypeError: webpack version 5.x is not supported"},{"fix":"Add 'piral-core' as a dependency in your pilet's package.json with the correct version.","cause":"The pilet's peer dependency on piral-core is missing or incorrect.","error":"Module not found: Can't resolve 'piral-core'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}