Use Parcel's --public-url option when building

By default Parcel prefixes output paths with /. So when Chrome loads
wpcarro.dev/goals it attempts to get the CSS and JS and other assets from
wpcarro.dev/ instead of wpcarro.dev/goals/. Using the --public-url ./ option
makes Parcel output relative paths, which should work better for my needs.
This commit is contained in:
William Carroll 2020-03-25 17:18:51 +00:00
parent 06d2467c56
commit 3ff6ae3697
2 changed files with 2 additions and 2 deletions

View file

@ -11,7 +11,7 @@ pkgs.stdenv.mkDerivation {
# parcel.js needs number of CPUs
PARCEL_WORKERS = "1";
buildPhase = ''
npx parcel build $src/index.html
npx parcel build src/index.html --public-url ./
'';
installPhase = ''
mv dist $out

View file

@ -11,7 +11,7 @@ pkgs.stdenv.mkDerivation {
# parcel.js needs number of CPUs
PARCEL_WORKERS = "1";
buildPhase = ''
npx parcel build src/index.html
npx parcel build src/index.html --public-url ./
'';
installPhase = ''
mv dist $out