Socket
Book a DemoInstallSign in
Socket

github-pages-plugin-for-type-route

Package Overview
Dependencies
Maintainers
0
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github-pages-plugin-for-type-route

Feature create-react-app/type-route/gh-pages compatibility

latest
Source
npmnpm
Version
2.0.5
Version published
Weekly downloads
4
-78.95%
Maintainers
0
Weekly downloads
 
Created
Source

What?

This is a build tool to enable Vite and create-react-app's sites that uses type-route to be deployed on gh-pages.

The Problem it solves

Github pages has no configuration to enable single pages application. If you GET https://my-domain.com/a/b/foo github page will serve a/b/foo.html when in reality we would like that, regardless of the url path, it's always the index.html that is served.
The workaround is to copy the content of index.html into a 404.html file, it works but it's very bad for SEO.

The solution

Copying the index.html everywhere there is a path before deploying.

How to set it up

image

image

image

WARNING: In the router.ts file you can only perform relative import, import using based on the baseUrl option of the tsconfig.json file are not supported.

Then when we run yarn build and this will get generated for us:

image

All this files are copies of index.html generated by the tool:

[
    "auteur.html",
    "evenements.html",
    "naturalisme.html",
    "naturalisme/antilles.html",
    "naturalisme/france.html",
    "naturalisme/ouset-canadiens.html",
    "naturalisme/reunion.html",
    "portrait.html",
    "404.html"
]

result: No more 404 🥳

image

This is a project that uses this module: https://github.com/thieryw/theo-tz
It's online here: http://thieryw.github.io/theo-tz

FAQs

Package last updated on 18 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts