{"id":20548,"library":"shakapacker","title":"Shakapacker","description":"Shakapacker is the official, actively maintained successor to rails/webpacker that integrates Webpack v5+ (or Rspack for 10x faster builds) with Rails for managing app-like JavaScript modules. Version 10.0.0 requires Node >=20 and supports Rspack v2, esbuild, and SWC loaders. Released by ShakaCode with regular cadence (v9.6.2 latest stable, v10.0.0 recent), it provides a robust Ruby gem and npm package for configuration, asset manifest generation, and development server integration. Key differentiators: native Rspack support, semantic config diffing (bin/diff-bundler-config), and compatibility with jsbundling-rails alternatives. Ships TypeScript types.","status":"active","version":"10.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/shakacode/shakapacker","tags":["javascript","typescript"],"install":[{"cmd":"npm install shakapacker","lang":"bash","label":"npm"},{"cmd":"yarn add shakapacker","lang":"bash","label":"yarn"},{"cmd":"pnpm add shakapacker","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core bundler dependency","package":"webpack","optional":false},{"reason":"Required for CLI and dev server","package":"webpack-cli","optional":false},{"reason":"Development server with HMR","package":"webpack-dev-server","optional":true},{"reason":"Generates manifest.json for asset map","package":"webpack-assets-manifest","optional":false},{"reason":"Alternative bundler core for Rspack support","package":"@rspack/core","optional":true}],"imports":[{"note":"Named export, not default. Available in ESM and CommonJS contexts.","wrong":"const shakapacker = require('shakapacker')","symbol":"shakapacker","correct":"import { shakapacker } from 'shakapacker'"},{"note":"Common for deployment scripts; must be imported from 'shakapacker/deployment' subpath.","wrong":null,"symbol":"ShakapackerDeployment","correct":"import { ShakapackerDeployment } from 'shakapacker/deployment'"},{"note":"Config class is separate from main package export. Ensure correct subpath import.","wrong":"import { ShakapackerConfig } from 'shakapacker'","symbol":"ShakapackerConfig","correct":"import { ShakapackerConfig } from 'shakapacker/config'"}],"quickstart":{"code":"// Install: yarn add --dev shakapacker@^10.0.0\n// Then configure webpack.config.js or rspack.config.js\nconst { shakapacker } = require('shakapacker');\n\n// Example: get public output path\nconst publicPath = shakapacker.publicOutputPath;\nconsole.log('Public path:', publicPath);\n\n// For deployment manifest\nconst { ShakapackerDeployment } = require('shakapacker/deployment');\nconst deployment = new ShakapackerDeployment({ manifestPath: './public/packs/manifest.json' });\ndeployment.deploy();\n\n// For configuration reading\nconst { ShakapackerConfig } = require('shakapacker/config');\nconst config = new ShakapackerConfig();\nconsole.log('Dev server enabled:', config.devServer?.enabled);","lang":"javascript","description":"Shows basic imports from shakapacker npm package: main export, deployment, and config subpaths."},"warnings":[{"fix":"Update Node to 20.x or later. Verify with node --version.","message":"Shakapacker v9 dropped support for Node < 20. Upgrade Node.js to 20+ before updating.","severity":"breaking","affected_versions":">=9.0.0 <10"},{"fix":"Replace event-based hooks with direct method overrides in ShakapackerConfig subclass.","message":"Shakapacker v10 removed deprecated event system hooks (pre_event, post_event). Use new hooks API.","severity":"breaking","affected_versions":">=10.0.0"},{"fix":"Switch to import { shakapacker } from 'shakapacker' in ESM context, or use dynamic import() if mixed.","message":"Using 'require('shakapacker')' with CommonJS is deprecated in v10. Use ESM imports.","severity":"deprecated","affected_versions":">=10.0.0"},{"fix":"Add '@rspack/core' to dependencies. If using webpack, ignore this warning.","message":"Rspack support requires peer dependency '@rspack/core' (>=1.0.0 or >=2.0.0-0). Missing this will cause silent fallback to webpack.","severity":"gotcha","affected_versions":">=9.0.0"},{"fix":"Uncomment 'headers' section in config/shakapacker.yml to restore Access-Control-Allow-Origin: *.","message":"DevServer CORS headers are disabled by default since v9.6.0. Cross-origin asset loading breaks if Rails and dev server on different ports.","severity":"gotcha","affected_versions":">=9.6.0"}],"env_vars":null,"search_vec":"'10.0.0':31 '10x':18 '20':34 'activ':6 'altern':87 'app':26 'app-lik':25 'asset':65 'bin/diff-bundler-config':80 'build':20 'cadenc':48 'compat':82 'config':78 'configur':64 'develop':69 'dif':79 'differenti':73 'esbuild':39 'faster':19 'gem':59 'generat':67 'integr':12,71 'javascript':28,91 'jsbundl':85 'jsbundling-rail':84 'key':72 'latest':50 'like':27 'loader':42 'maintain':7 'manag':24 'manifest':66 'modul':29 'nativ':74 'node':33 'npm':61 'offici':5 'packag':62 'provid':55 'rail':22,86 'rails/webpacker':10 'recent':53 'regular':47 'releas':43 'requir':32 'robust':57 'rspack':16,37,75 'rubi':58 'semant':77 'server':70 'shakacod':45 'shakapack':1,2 'ship':88 'stabl':51 'successor':8 'support':36,76 'swc':41 'type':90 'typescript':89,92 'v10.0.0':52 'v2':38 'v5':14 'v9.6.2':49 'version':30 'webpack':13","created_at":"2026-04-25T11:23:42.609406+00:00","updated_at":"2026-04-25T11:23:42.609406+00:00","problems":[{"fix":"Run 'yarn add shakapacker@^10.0.0' or 'npm install shakapacker@^10.0.0'.","cause":"Typo or missing dependency; shakapacker npm package not installed.","error":"Module not found: Error: Can't resolve 'shakapacker'"},{"fix":"Replace 'bin/shakapacker --watch' with 'bin/shakapacker-watch --watch' in Procfile or CLI.","cause":"Deprecated --watch flag removed in v10; use 'bin/shakapacker-watch' instead.","error":"Unknown option: '--watch' for shakapacker"},{"fix":"Update webpack config to use cacheGroups instead of chunks. Refer to webpack 5 migration guide.","cause":"webpack v5 removed splitChunks.chunks; use optimization.splitChunks.cacheGroups.","error":"WebpackOptionsValidationError: Invalid configuration object: configuration has an unknown property 'optimization.splitChunks.chunks'"},{"fix":"Upgrade to shakapacker v9.6.1+ which adds defined?(Rails) guard, or manually set RAILS_ENV.","cause":"Calling Shakapacker::Env#current outside of Rails context (e.g., in bin/dev).","error":"Env#current raises NameError: undefined method `env' for nil:NilClass"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"shakapacker","cli_version":null,"type":"library","homepage":"https://shakacode.com","github":"https://github.com/shakacode/shakapacker","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/shakapacker","openapi_spec":null,"status_page":null,"smithery":null,"categories":["web-framework","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}