symfony/asset-mapper
Symfony AssetMapper exposes asset directories, copies them to a public folder with digested/versioned filenames, and can generate an importmap so you can use modern JavaScript modules without a build step.
Eliminate Build Step Overhead: Replace Laravel Mix/Webpack/Vite for projects with simple asset pipelines (e.g., static sites, marketing pages, or prototypes). Reduces devops complexity by removing Node.js dependencies and build steps.
Modern JavaScript Adoption Without Bundlers:
import/export) and package managers (e.g., esm.sh) via importmap generation.Cache-Busting for Static Assets:
app.[hash].js) to invalidate browser caches during deployments.Unified Asset Pipeline:
?v=1.2 queries or custom scripts.Dev/Prod Parity:
version_strategy: 'timestamp' in development and hash in production via environment-specific configs.Security Hardening:
script-src 'self').import/export) but lack a bundler (e.g., Webpack, Vite).?v=1.2 queries or custom PHP asset scripts with a maintained solution."Simplify Frontend Delivery Without Sacrificing Performance"
app.[hash].js) to eliminate stale asset issues.import/export) via importmap, letting teams adopt React/Vue without Webpack."A Drop-in Replacement for Manual Asset Workflows" Key Value Props:
No Build Step:
npm run dev/npm run build with a single php artisan asset-map:dump command.npm install && npm run build # 30s → 1GB Node_modules
to:
php artisan asset-map:dump # 2s → 0 dependencies
Importmap for Modern JS:
importmap.json to enable:
<script type="module">
import React from 'https://esm.sh/react@18';
import App from './app.js';
</script>
Cache-Busting Out of the Box:
app.[hash].js auto-version on changes, fixing:
Laravel Integration:
'source_dirs' => [
resource_path('assets'), // Static files
public_path('mix-manifest'), // Laravel Mix outputs
],
Performance:
Migration Path:
?v=1.2 queries with hashed filenames.Risks Mitigated:
Call to Action: "Let’s pilot this on [Project X] to eliminate build steps for static assets—reducing deployments from 5m to 2m."
How can I help you explore Laravel packages today?