github-pages-plugin-for-type-route
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

What?

This is a build tool to enable 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

Keywords

none

Install

npm i github-pages-plugin-for-type-route

DownloadsWeekly Downloads

11

Version

0.1.0

License

MIT

Unpacked Size

16.4 kB

Total Files

16

Last publish

Collaborators

  • garronej