3 years ago

Deploying Laravel Mix to Heroku

Posted 3 years ago by entriol

I successfully deployed Laravel to Heroku. Added buildpacks in this order.

=== app Buildpack URLs
1. heroku/nodejs
2. heroku/php

And also in package.json, I provided scripts to build asssets in production.

"postinstall": "npm run production"

Everything works except one thing. Versioning. In webpack I have version(), and it works fine when I fire npm run production on my local machine. But in heroku, versioning does not working. I pasted output from heroku.

remote:        > @ production /tmp/build_8c7781f6ff90b919667b337b3006842e
remote:        > node node_modules/cross-env/bin/cross-env.js NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
remote:       95% emitting
 DONE  Compiled successfully in 30218ms
re            Asset      Size  Chunks                    Chunk Names
remote:        /js/app.js    294 kB       0  [emitted]  [big]  /js/app
remote:        /css/app.css    135 kB       0  [emitted]         /js/app
remote:        mix-manifest.json  66 bytes          [emitted]
remote:        Done in 66.33s.

Scripts minimized and merged, but there's no versioning. Any idea to fix it?

In case you ask it, this is environment on heroku for nodejs: I use node ^7.x, npm ^4.x

remote:        NPM_CONFIG_LOGLEVEL=error
remote:        NPM_CONFIG_PRODUCTION=false
remote:        NODE_VERBOSE=false
remote:        NODE_ENV=production
remote:        NODE_MODULES_CACHE=false

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