How to manage, build and deploy frontend assets and js in Laravel packages

Published 2 months ago by pvledoux

Hi guys,

I have multiple packages to build for a big application we are working on and I'm wondering how I will deal with frontend dependancies (js packages, images/fonts, sass).

Currently I have package.json in my root package folder with all dependencies for that package, and I have postinstall script in my main package.json to scan all subfolders of the packagesfolder to run npm install when necessary.

But how I do I build/deploy those assets?


@pvledoux You define your application’s dependencies in your package.json file. When deploying, run npm run prod to build your assets and include the generated files in your deployment (but ignore them from your source control repository).


@martinbean Yes for the application it's not an issue, I'm speaking about dependencies of custom Laravel packages (


@pvledoux Packages should provide a “dist” (compiled) version of its assets, that you bundle in your “parent” application. You could maybe set up a pre-commit hook in your package directories that automatically compiles and adds those compiled versions to the commit.

Please sign in or create an account to participate in this conversation.