CSS/JS not working on nextjs export on github pages
Unanswered
Shiny Cowbird posted this in #help-forum
Shiny CowbirdOP
Yea so I am using nextjs export to host a static site on github pages but it generates the html file as
changing the exports to
<link rel="stylesheet" href="/_next/static/css/982d77a424848a5f.css" data-precedence="next" />
<link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-342f45a84652a107.js" />changing the exports to
"./_next/...." seems to make everything work ( atleast locally ), I found the same thing here https://stackoverflow.com/questions/58784444/nextjs-export-is-broken-no-css-no-js, although I am not sure if there is a way around this or a fix to this so when github actions autogenerates the out file it generates it with that, please tell if any2 Replies
Shiny CowbirdOP
anyone?
Shiny CowbirdOP
- name: Fix absolute paths for GitHub Pages
run: |
find out -type f -name "*.html" -exec sed -i 's|="/_next|="./_next|g' {} \;
find out -type f -name "*.js" -exec sed -i 's|="/_next|="./_next|g' {} \;just added this to my github actions and it fixed it ig