简体   繁体   中英

Heroku doesn't load js (only css) files to production but locally it works

I couldn't find the correct answer to my issue so I have to ask you guys. I am developing my node (express) app to Heroku, but production build of Heroku takes only CSS files from my public folder. However, when I type:

heroku local web

in my terminal, everything works fine. Here is my server.ts file to include public assets:

app.use("/public", express.static(path.join(__dirname + "/public")));

and this is my folder structure:

-root
   server.ts
   -public
      css/
      js/

If I check "Sources" in production Heroku app I see that CSS folder is included but not js.

Thanks

好的,问题与我的.gitignore文件有关,其中包含了这个public / js。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM