- Fix incomplete npm build
- Exclude
.history
and.github
files from npm package
- Fix sourcemap generation for UglifyJS
- Retag this release for @latest. Due to some experimentation with semantic-release, a release to the @latest npm tag has been made on the v6 branch in various scenarios.
- Removed
jsesc
until we can find a better way to handle utf-8 encoding for routeInfo - Removed a stray console.log
- Log errors during build configuration step to aid in build debugging.
- Updates examples sites & various documentation typos
- Log errors during build configuration step to aid in build debugging.
- Moved away from Slack to Spectrum for support and community.
- Fixed a regression that prevented cache busting on routeInfo.js files
- static/index.js logic is now broken up into smaller pieces.
- Added various tests for parts of static/index.js
- Upgraded snapshots for testing
- Removed deprecated react-hot-loader/patch from webpack dev entry, but kept the
react-hot-loader
entry to ensure it is required before React. - Updated tests to work with regressions
- Add tests for building a sitemap
- Add tests for building the config
- Improved Gentics Mesh example
- Fix an issue with routeInfo not loading on 404 pages
- String comparisons are used for env variables now
- Ignore tests when created a build
- Fix examples that use the css loader to work correctly
- Don't replace hrefs if route prefixing is disabled
- New sites in the built-with list
- An automated was added to test all examples build integrity
- Upgraded some dependencies
- Fix inifinite loading issue introduced with 5.9.0
- The
<Loading>
component and theonLoading
method now return a more detailed loading state.0
for not loading,1
for "soft" loading (when navigation is happening) and2
for "hard" loading (when asynchronous assets are being requested).
- Switch from
babel-preset-latest
tobabel-preset-env
. - Remove unnecessary
babel-preset-stage-3
since it's included already withbabel-preset-stage-0
.
- Expose the react-static babel settings as a
babel-preset.js
file for more complex babel setups..babelrc
uses this preset for backwards compatibility.
- Upgraded
swimmer
to hide log messages. - Document-level rendering now uses
renderToStaticMarkup
instead ofrenderToString
. This ensures there is no code comments or meta markup in the
- Upgrade Documentation example and expose some undocumented utilities to the outside world.
- Remove console.log from
documentation
example
- Added a
config.disableDuplicateRoutesWarning
option.
- Improved
getPath
andcleanPath
methods, and added some simple tests for them.
- Added the
pagination
example. - Added a
makePageRoutes
utility function on thereact-static/node
import to help with generating page routes from an array of items.
- Added a
config.disableRouteInfoWarning
configuration option to silence missing route information in development
- Missing routeInfo.json requests do not throw in production now.
- Fixed an error where router
path
s would not match as expected during static export. It now uses the same format (leading slash at root patsh) as react-router does by default during development.
- New Error handler component and accompanying tests. Thanks @jasonlafferty!
- Improved prefetch lifecycles and page responsiveness for slow networks.
- Added hidden feature to rebuild routes and routeData automatically when the config is edited during development.
- Added hidden feature to rebuild routes and routeData during development.
- Fixed yet another issue in the dev server that could result in a 404 on first load.
- Fixed gitignore files from not being generated
- Fixed an issue in the dev server that would result in a 404 on first load.
- Upgrade eslint rules to latest versions
- Fix
gitignore
issues
.gitignore
files can now have thedot
prefix in examples. Automatic changes resulting in a.npmignore
name swap are handled byreact-static create
react-static build --debug
flag now uses thedevelopment
flag so as to not hide react warnings, errors and disable react minification- Changed default
dist
folder during development totmp/dev-server
- No more losing internal state in components during hash navigation
- Dev server now serves
public
directly through webpack, allowing immediate feedback to changes in its files.
--config
CLI argument accepts a path again.- Netlify CMS example now uses
npm
instead ofyarn
as the default Netlify script - Documentation Updates
- CLI now uses
pretty-error
! - CLI route export errors now display the route that errored.
- TypeScript example now excludes node_modules in
tsconfig.json
- MaterialUI updated to use latest beta
- In the
typescript
example,ts-loader
is fixed for webpack 3 less-antdesign
has been updated to run and work properly.
- Added
config.extractCssChunks
option. Set totrue
for automatic style-splitting and importing usingExtractCssChunks
instead ofExtractTextPlugin
. - Added
config.inlineCss
option. Set totrue
to inline all styles into the resulting HTML document instead of usinglink
tags.
- Server-side rendering of UTF-8 characters no longer behaves erratically.
- Resulting HTML for a route no longer includes double instances of route data.
- Auto hash scrolling is no more responsive and handles more edge cases.
- Fetching route info for non-existent routes now has better logging.
- Fixed a bug where an imported
woff2
file extension would crash babel.
- Fixed a missing export of
propsByHash
. - Added
update-notifier
so people can keep up with all these updates!
- Moved
gitdocs
to dev dependencies - Added
shrink-to-fit
to defaultDocument
meta.
- Production code-split components that error will now log the correct error to the console.
- Added
routeInfo
to theconfig.Document
component.
- The
react-hot-loader/babel
is no longer used in production. Who's the dummy who did that?! (...me, haha) compact: false
is now the default in.babelrc
. Only a select few care about those compaction messages anyway.- Various
__dirname
references are now fixed with the correct number of../
's
- Fixed a rare issue where hash links may not be scrolled to if navigation is fast enough (imagine that ;)
- Added a
config.paths.root
option that is also rare.
- Fixed a rare issue (in Gitdocs mostly) where a RouteData would not load even though routeInfo.allProps was synchronously accessible.
.com
or any other suffix is no longer clipped fromsiteRoot
.- Absolute URL rewriting now takes into account
basePath
and alsosrc=''
attributes - 404 component more reliably supports
RouteData
and is generally more stable. - An
is404
prop is now available viaRouteData/withRouteData
if and when rendered on a 404 page, regardless if it is the /404 route itself or any other route that results in a 404. - Fixed some hot-reloading side effects that were introduced with the new project architecture.
- Lost some weight on the node packaging. The docs and many other large files are now excluded from distribution.
- Improved the node API support with much more stability.
- Added a
key
prop to the rendered route inreact-static-routes.js
to avoid stale or mixed state for routes that happen to share the same top-level component. - Removed complexity from the user by making the
<Routes>
component'sgetComponentForPath
render prop more robust. (Check documentation if you use custom rendering for yourreact-static-routes
)
- Added a
Redirect
component androute.redirect
option to routes.
src='/'
paths are now also rewritten with siteRoot and basePath
- Added Node API to React-Static via importing
react-static/node
- Added the ability to use a custom
static.config.js
via the CLI - Added
config.basePath
option for hosting and running react-static sites from a sub-route - Added
config.stagingSiteRoot
,config.stagingBasePath
,config.devBasePath
. Used for overriding the above options in specific environments - Added the ability to create projects using a local template location.
- Entire repo has been reorganized and split for easier maintenance and project grokking ability.
- Template information and route data hashes are now automatically generated and collocated in a
routeInfo.js
for each route, instead of in a single location (give them massive sites some support, baby!) - Fixed
config.siteRoot
to be more reliable, but must no longer contain a sub route (it will be stripped) - React Router now uses
config.basePath
for itsbasename
prop - History instances now use
config.basePath
for thebasename
option - Moved the codegen for
react-static-routes
to its own file - Added
maximum-scale=1
to the default document component's viewport meta - More reliable handling of path slashes throughout the codebase
- Added react
key
props to head scripts, links and preloads
- Scrolling to a hash is now more accurate, especially if the page reflows during mid scroll.
- Added documentation website that is built with
gitdocs
. Still a few kinks to work out. - Updated build-with site list
- All
.gitignore
files are now uniform to not include the.
until copied during creation - Fixed an import typo with the
sass
example - Added a basic error logging handler for universally-code-split components
- Various upkeep items on the Netlify-CMS example
- CLI now uses
commander
- Disabled code-splitting in dev mode. This fixes a majority of problems with react-hot-loader without requiring users to make a ton of changes to their exports.
- CLI now supports using a
.git
address to clone for the template.
- Fixed
component
style render props from not passing children
Router.scrollToHashOffset
prop allows for setting an offset for hash scrolling now :)- Added
netlify-cms
example.
- Squashed some bugs
- Removed the various
extract-hoc
related babel plugins in favor of the newreact-hot-loader
version 4.
- Added
--staging
CLI argument toreact-static build
that does not perform build-time optimizations like siteRoot replacement on links assets, etc. If you are testing your site locally, you will likely want to use this option to allow your production site to be navigable on localhost.
- Automatic Route Splitting. From here on out as long a project is using the automatic component-based static routing, all route templates will be automatically deduped and split into separate modules. These modules are statically-rendered into every page that uses them, are preloaded asynchronously with React-Static built-in prefetching utiliies, and are also loaded on demand if needed as the client navigates through your site. Carry on!
- Automatic prefetching of templates and assets. Any eligible
Link
component to a code/data-split destination will automatically queue a prefetch for the appropriate assets. - Render prop versions of
withRouteData
andwithSiteData
are now available asRouteData
andSiteData
. These support inline access to their respective props, instead of having to set up an HOC. They also support all three major render prop syntaxes, so render those props however you want!. See the README for more information. - Added a new
Loading
render prop component and a companionwithLoading
HOC component to easily display React-Static's loading state (that probably won't happen much, but still... ;). - Added a new
Loading
/withLoading
render prop / HOC component pair. You can render this component to gain access to theloading
prop, which was previously only accessible via theRouter.subscribe
callback. - Path changes now automatically scroll to the top of the page. Duration defaults to
0
ms, but can be modifed via thescrollToTopDuration
prop on theRouter
component. - Hash routing changes now automatically scroll to the element (or top of the page if the hash is removed but the path stays the same). Duration defaults to
800
ms, but can be modifed via thescrollToHashDuration
prop on theRouter
component.
- In some previous scenarios the window's
location.search
would be taken into account when matching a path. That is now not the case. You could never previously rely on URL parameters for static paths, but now we're letting you know :) - The
getRouteProps
andgetSiteData
HOC's have both been renamed towithRouteData
andwithSiteData
. Using the old methods will result in a deprecation notice and a broken app. Luckily this is an easy find and replace :) Router.subscribe
has been deprecated. Though, if you still need programmatic access to a loading event, you can use the newonLoading
subscriber that functions the same way.
- In your components:
- Replace all instances of
getRouteProps
withwithRouteData
- Replace all instances of
getSiteProps
withwithSiteData
- Replace all instances of
Router.subscribe
withonLoading
, and importonLoading
.
- Replace all instances of
- In your
static.config.js
:- Replace all instances of
getProps
withgetData
- Replace
getSiteProps
withgetSiteData
- If you are using a custom
Document
be sure to replace thesiteProps
prop withsiteData
.
- Replace all instances of
- Note: To take advantage of auto-code-splitting, you cannot use custom routing for your static routes. I suggest migrating to the automatic routing strategy asap.
getRouteProps
was fixed to always have access to the router props, thus supportinggetRouteProps
as nested components instead of top-level page components.
- Node version was rolled back to
<=6.10.0
, to allow some existing users continued usage.
- Preact can now be used in production by setting
preact: true
in yourstatic.config.js
! Remember to useReactDOM.render
instead ofhydrate
in production too :) - Added the
preact
example.
getRouteProps
now functions as it should when it's wrapped component receives new props without remounting. (Thanks @EmilTholin!)- Node
>=7.5.0<=6.10.0
is now stated as required, instead of implied. - When building for
node
stage, themain
is now preferred in package imports, instead ofmodule
- Better module resolution locations, which allows overriding react-static module versions by installing them locally.
- Added Firebase Authentication example (Thanks @deden!)
- Better error logging for unhandled promise rejections
- Handle Routes with spaces (Thanks @etimberg!)
- Add shouldPrefetch() method to avoid setting loading state (Thanks @chrisbrown-io!)
- Pass DOM props through in links (Thanks @denis-sokolov!)
- Pass additional CLI arguments through to getSiteData() (Thanks @etimberg!)
- Common props returned by
getRouteProps
(props that===
one another) now promoted to shared props and only requested once per session. Learn more in the docs: Automatic Data and Prop Splitting. Depending on your site, this may significantly decrease site bandwidth and increase both initial page load speed and subsequent page load performance.
<Routes>
now accepts a render prop for custom rendering of automatic routes.- Added
animated-routes
example.
Link
andNavLink
now properly render hash links and external links. (Thanks @denis-sokolov!)sass
example now uses a proper webpack loader configuration for style extraction. (Thanks @talves!)
Link
andNavLink
now properly render hash links and external links. (Thanks @denis-sokolov!)sass
example now uses a proper webpack loader configuration for style extraction. (Thanks @talves!)
- Added
sass
example. (Thanks @2metres!) - Added
glamorous-tailwind
example. (Thanks @deden!) - The
REACT_STATIC_ENV
environment variable is now used internally (and set deterministically via usage of thestart
andbuild
commands) instead ofNODE_ENV
. This means you can finally set your ownNODE_ENV
variables and use tools likecross-env
. Yay!
- Fixed some misleading phrasing where a route component path could be assumed to be compatible with a class, function, or react component, when in fact it is the path to that. (Thanks @Jonarod!)
config.path.src
is now taken into account when constructing theconfig.path.entry
path. (Thanks @crubier!)- Added
manta.life
to list of sites built with React Static. (Thanks @hql287!) - Updated the
graphql-request
example to usereact-markdown
instead ofdangerouslySetInnterHTML
. (Thanks @hmeissner!)
- Added
graphql-request
example. (Thanks @ChrisNLott!)
- Use ReactDOM.render instead of ReactDOM.hydrate in dev (Thanks @EmilTholin!)
- Cordova example's
res
directory is no longer included in the npm distribution making releases and installations much faster.
- Fixed a bug where windows users could not serve or build a project. (Thanks @karland!)
- Fixed a bug where some directories or files weren't being included in npm distributions
- Fixed a bug where component names with numbers would not render propertly. (Thanks @muloka!)
config.paths.devDist
can now be set to specify a different scratch output directory when in development mode.
react-static-routes
imports are now relative, thus avoiding absolute path madness... hopefully? :)
- Added Probot to the github repo! Hooray!
- Better yarn/npm colors in cli. @cgmx
- Router now uses
componentDidCatch
to gracefully display runtime errors for you.
react-static-routes
now uses dynamic template imports. @EmilTholin- Helmet meta tags are more reliably extracted. @EmilTholin
- Config server is no longer served separately, but piggybacks on webpack dev server. @rileylnapier
- Added
config.paths
, which can now be used to customizedist
folder location and other file locations used by react-static - Added
onStart
hook. Fires after the first successful dev build when runningreact-static start
- Added
onBuild
hook. Fires after a successful production build when runningreact-static build
- Added
config.devServer
, which can be used to customize the configuration for the webpack-dev-server used in development. (Thanks @rywils21!) - Added TypeScript typings for React-Static core exports (Thanks @D1no!)
- Allow customization of dev server PORT and HOST via those environment variables. (Thanks @rywils21!)
config.getRoutes
is no longer required and will default to exporting a single root path.- Webpack configurations can now be exported and used externally. (Thanks @crubier!)
<Router>
component now supports atype
prop that can be:browser
,hash
, ormemory
, which defines which type ofhistory
object to create and use internally. Useful for non-web environments or situations where your app will be accessed in a filesystem or nested domain as opposed to a web server.- Added Redux example (Thanks @crubier!)
- Added Apollo GraphQL example (Thanks @crubier!)
- Added Redux + Apollo example (Thanks @crubier!)
- Added Typscript example (Thanks @D1no!)
- The
Document
's<title>
tag can now be used as a fallback to any<title>
tag produced via the<Head>
component. (Thanks @EmilTholin!) - Fixed a bug where not defining a 404 component resulted in an error during production build. (Thanks @mplis!)
- Fixed a bug where the webpack dev server would rebuild the app multiple times in a row when started up for the first time. (Thanks @cgmx!)
- The
webpack
function instatic.config.js
has a new function signature.- Each function is now not required to return a new config object. If a falsey value is returned, the transformation will be ignored, and the next transformation will carry on as normal. Even so, avoid mutating the config object at all costs ;)
- A new argument is now available in the
args
parameter calleddefaultLoaders
:
These loaders are here for convenience. Please read the documentation for more information.webpack: ( config, { defaultLoaders: { jsLoader, cssLoader, fileLoader } } ) => {...}
- A dynamic code-splitting example and typescript example are now available! Huzzah!
- Webpack files are now hashed for better cache invalidation. It's about time right?!
- Your
index.js
file must now export your app in NON-JSX form, eg.export default App
, not<App />
. With this change, builds can be faster, leaner, and have more control over the build pipeline. - The optional
Html
component instatic.config.js
was renamed toDocument
. - The
preRenderMeta
andpostRenderMeta
hooks instatic.config.js
have been deprecated in favor of the newrenderToHtml
hook. This is a very important change, so please check the readme if you are using these hooks! - The new
renderToHtml
hook now uses a mutable meta object. This object is passed as a prop to the baseDocument
component asrenderMeta
now, instead of the previousstaticMeta
.
- New
PrefetchWhenSeen
component allows for prefetching when component becomes visible in the viewport.
- Exporting is now up to 2x faster after switching from a dual pass to a single pass render strategy.
- Fixed a very elusive and angering bug where imported node_modules were not being shared between the node context and the node webpack build of the app used for exporting.
- The
webpack
function instatic.config.js
has a new function signature.- The new value can be an array of functions or a single function.
- Each function passed will receive the previous resulting (or built-in) webpack config, and expect a modified or new config to be returned. See Webpack Config and Plugins
Now that the webpack
callback accepts an array of transformer functions, the concept of plugins has been introduced. These transformer functions are applied in order from top to bottom and have total control over the webpack config. For more information see Webpack Config and Plugins
webpack: [
withCssLoader,
withFileLoader
]
All route exporting is now done via a node bundle that is packaged with webpack. This should dramatically increase reliability in customization and cross-platform usability.