question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Composer scripts output not being saved

See original GitHub issue

Bug report

Description

Composer scripts run perfectly (thanks!)

        "vercel": [
            "npm install",
            "npm  run prod"
        ]

However the build output (js/css) isn’t available after the build is complete. If it helps, I’m using laravel mix

21:03:07.975 | > cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
21:03:20.083 | DONE  Compiled successfully in 10120ms3:03:20 AM
21:03:20.087 | Asset       Size  Chunks                    Chunk Names
21:03:20.087 | /css/app.css   8.47 KiB       1  [emitted]         /js/app-server
21:03:20.087 | /js/app-client.js    169 KiB       0  [emitted]         /js/app-client
21:03:20.087 | /js/app-client.js.LICENSE.txt  219 bytes          [emitted]
21:03:20.087 | /js/app-server.js    326 KiB       1  [emitted]  [big]  /js/app-server
21:03:20.087 | /js/app-server.js.LICENSE.txt  219 bytes          [emitted]
21:03:20.157 | 🐘 Running composer scripts [DONE]
21:03:28.993 | 🐘 Creating lambda
21:03:36.877 | Uploading build outputs...
21:03:40.526 | Build completed. Populating build cache...
21:03:48.266 | Uploading build cache [26.75 MB]...
21:03:48.921 | Build cache uploaded: 662.765ms
21:03:48.931 | Done with "api/index.php"

(apologies for the formatting on that)

however /css/app.css and /js/app-client.js return 404’s when the site is loaded (website if I run npm run prod locally and commit the output to git: https://phase-blog-demo.now.sh/)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
f3l1xcommented, Aug 11, 2020

I placed it to readme. Thanks for the issue.

1reaction
f3l1xcommented, Aug 7, 2020

Hmm, I think I know where is the catch. Files created in build phase (during call composer run vercel) are not accessible from browser/routing/routes.

I solved it with little trick in satis example.

https://github.com/juicyfx/vercel-examples/blob/d615f48830491e54afba30d0e54f402a6e6ccc0e/php-satis/index.php#L3-L9

I am in touch with Vercel team. For now, test please this approach.


 "routes": [
      { "src": "/css/(.+)",  "dest": "/api/assets.php?file=/public/css/$1" },
      { "src": "/js/(.+)",  "dest": "/api/assets.php?file=/public/js/$1" },
      { "src": "/(.*)",  "dest": "/api/index.php" }
 ],
Read more comments on GitHub >

github_iconTop Results From Across the Web

PHP Composer scripts don't fire - Stack Overflow
The ComposerScripts methods work if I test them with composer run-script and the test.sh script works fine, but when I install or update...
Read more >
Command-line interface / Commands - Composer
--no-scripts: Skips execution of scripts defined in composer.json . --no-cache: Disables the use of ... There is also an init command available to...
Read more >
DataWeave Scripts - MuleSoft Documentation
If the mime types of the inputs differ, and no output is specified, the script throws an exception so that you know to...
Read more >
Composer — DeepStream 6.1.1 Release documentation
The Composer is an GUI application designed to create AI Application ... Be sure the component list is not empty before opening any...
Read more >
How to build and distribute beautiful command-line ...
Run the following command to create a composer.json file interactively: ... Once the script is done, you should see the dependency listed in ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found