Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Webpack Encore Bundle Laravel Package

symfony/webpack-encore-bundle

Symfony bundle integrating Webpack Encore into your app. Adds asset building, versioning, and entrypoint management with simple Twig helpers for scripts/styles, plus sane defaults and easy configuration for modern JS/CSS workflows.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Frontend Asset Optimization Roadmap:

    • Adopt code-splitting (via splitEntryChunks()) to reduce initial load time and improve Core Web Vitals (LCP, FID).
    • Enable dynamic asset loading (e.g., lazy-loading JS/CSS for non-critical routes) to align with progressive enhancement principles.
    • Build vs. Buy: Avoid reinventing Webpack integration; leverage this bundle to reduce dev time and maintain compatibility with Symfony’s ecosystem.
  • Stimulus.js Integration:

    • Standardize Stimulus controller/target/action usage across templates (deprecated in favor of symfony/stimulus-bundle but still supported for legacy projects).
    • Simplify form interactions (e.g., real-time validation) by embedding Stimulus attributes via Twig filters (stimulus_controller(), stimulus_action()).
  • Performance-Critical Use Cases:

    • Remote entrypoints.json hosting: Reduce build artifacts in version control by offloading Webpack metadata to a CDN or CI-generated endpoint.
    • Preload/prefetch optimization: Add integrity hashes to <link> tags for resource hints, improving security and reliability.
  • Tech Stack Modernization:

    • Symfony 8/PHP 8.4 compatibility: Future-proof the stack by adopting this bundle’s latest version (v2.4.0+) to avoid migration blockers.
    • Deprecation cleanup: Replace legacy Stimulus functions with symfony/stimulus-bundle to reduce technical debt.

When to Consider This Package

  • Adopt if:

    • Your Symfony app uses Webpack Encore for asset management and needs dynamic entrypoints (e.g., route-based JS/CSS splitting).
    • You require Stimulus.js integration in Twig templates (even if migrating to symfony/stimulus-bundle long-term).
    • Your team prioritizes performance (e.g., reducing bundle size, enabling preload hints) without manual Webpack config tweaks.
    • You’re on Symfony 5.4+ and PHP 8.1+ (or planning to upgrade).
  • Look elsewhere if:

    • You’re not using Webpack Encore: This bundle is tightly coupled to Encore’s entrypoints.json format.
    • Your frontend stack is non-JS (e.g., static sites, no dynamic assets).
    • You need advanced Webpack customization (e.g., custom loaders/plugins) beyond Encore’s defaults—consider raw Webpack config or webpack-blocks.
    • Your app uses legacy Symfony <5.4 or PHP <8.1: Requires major version upgrades to use v2.x.

How to Pitch It (Stakeholders)

For Executives: "This package lets us automate Webpack asset optimization in Symfony, cutting initial load times by 30–50% through code-splitting and lazy-loading. It’s a maintenance-free upgrade—no need to hire frontend experts—while enabling features like real-time form validation (Stimulus.js) without extra dev work. Used by Symfony’s core team, it’s battle-tested and aligns with our roadmap for faster, more scalable apps."

For Engineering: *"The WebpackEncoreBundle handles the heavy lifting of:

  1. Dynamic asset loading: Auto-generates <script>/<link> tags from Webpack’s entrypoints.json (local or remote).
  2. Stimulus.js integration: Simplifies Twig templates with stimulus_controller() filters (deprecated but still useful for legacy code).
  3. Performance wins:
    • Preload hints with integrity hashes (reduces flash-of-unstyled-content).
    • Remote entrypoints.json to shrink repo size.
  4. Zero-config: Works out-of-the-box with Symfony Flex; minimal setup for code-splitting. Tradeoff: Tight coupling to Webpack Encore, but we’re already using it. Recommend adopting v2.4.0+ for Symfony 8/PHP 8.4 support and long-term stability."*

For Developers: *"Stop manually writing <script> tags! This bundle:

  • Auto-renders Webpack assets per route (e.g., app.js only loads on /app).
  • Supports Stimulus with Twig helpers (e.g., {{ stimulus_controller('hello') }}).
  • Fixes edge cases: Handles sub-requests, null attributes, and PHP 8.4 safely. How to start:
  1. Install: composer require symfony/webpack-encore-bundle.
  2. Configure webpack.config.js with splitChunks.
  3. Use {{ encore_entry_link_tags() }} in Twig. Pro tip: Enable remote entrypoints.json to avoid bloating your repo with build artifacts."*
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
calmfox/watch-sylius
damienfern/grpc-symfony-bundle
atoolo/index-bundle
atoolo/genai-bundle
coprotoai/laravel-ticket
davidjln/llm-carbon-bundle
cryonighter/valid-request-bundle
coolms/taxonomy-bundle
coolms/field-bundle
articulate-orm/symfony
aaix/laravel-tall-architect
ephoto/akeneo-connector
emmanuelballery/eb-plantumlbundle
emielburgman/symfony-visitor-beacon
emielburgman/symfony-visit-storage
emielburgman/symfony-security-headers
emielburgman/symfony-log-viewer
emarref/xdebug-bundle
emarref/pubnub-bundle
elriseio/finance-money-bundle