Giter Site home page Giter Site logo

react-static / react-static Goto Github PK

View Code? Open in Web Editor NEW
10.3K 130.0 759.0 36.92 MB

โš›๏ธ ๐Ÿš€ A progressive static site generator for React.

Home Page: https://github.com/react-static/react-static/discussions

License: MIT License

JavaScript 92.79% CSS 2.88% TypeScript 4.33%
react react-static static static-site static-site-generator marketing

react-static's Introduction

This is now in maintenance only mode. No new major versions will be released.

Remix and NextJS are good alternatives.

Where is react-static 8? The state of react-static -- and its inevitable death. #1661


React Static Logo

Travis CI Build Status npm package v npm package dm Github Stars Twitter Follow



You are viewing the docs for v7 of React Static. You can browse all historical versions via Github branches!

React Static

A progressive static-site generator for React.

React-Static is a fast, lightweight, and powerful progressive static site generator based on React and its ecosystem. It resembles the simplicity and developer experience you're used to in tools like Create React App and has been carefully designed for performance, flexibility, and user/developer experience.

Features

  • โš›๏ธ 100% React (and friends!)
  • ๐Ÿš€ Blazing fast builds and performance.
  • ๐Ÿšš Data Agnostic. Supply your site with data from anywhere, however you want!
  • โœ‚๏ธ Automatic code and data splitting!
  • ๐Ÿ’ฅ Instant navigation and page views
  • โ˜”๏ธ Progressively Enhanced and mobile-ready
  • ๐ŸŽฏ SEO Friendly.
  • ๐Ÿฅ‡ React-centric developer experience.
  • ๐Ÿ˜Œ Painless project setup & migration.
  • ๐Ÿ’ฏ Supports 100% of the React ecosystem. Including CSS-in-JS libraries, custom Query layers like GraphQL, and even Redux.
  • ๐Ÿ”ฅ Hot Reloadable out-of-the-box. Edit React components, styles and even data in real-time.

Sites Built with React-Static

See a list of sites

Quick Start

  • Install the CLI tool:
$ npm i -g react-static
# or
$ yarn global add react-static
  • Start a new project!
$ react-static create
  • Need some help?
$ react-static --help

Documentation

Migration from a previous version?

The CHANGELOG contains information on breaking change for each major version. The latest breaking changes along with their migration tips are located here

What is a progressive static site?

A progressive static site is a website where every statically exported HTML page is an entry point to a fully-featured automatically-code-split React application. Just like a normal static site, static progressive websites are capable of loading initial landing pages very quickly, but then extend the user experience by transforming invisibly into a single-page React application.

Once a progressive static site page has loaded its React application it can then do amazing things!

  • Prefetch page assets
  • Instantly navigate between pages
  • Provide interactivity not possible in normal static sites
  • Subscribe to and display real-time and dynamic data
  • Anything you can imagine within a React application!

How does it work?

Flow Chart

React Static gathers your data, and templates together and intelligently splits them into bite-size static files using webpack and javascript. Once these files have been generated, React Static uses them to render and export a list of routes that you provide it into HTML files! After your site has been exported, the resulting data, template, and html files can be transfered to a static file server and browsed as an awesomely fast and performant static website!

But remember, a progressive static site is more than that...

Little did you know that when React Static exported your site, it also generated a tiny, optimized, and code-split version of your original React application for every page of your site! After these pages have loaded, React invisibly mounts this application to the existing HTML on the page and... ๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰ You are now using the single page React application you originally built! This application is special, though! While you browse your website, pages that you might go to next are automatically preloaded, making navigation to them instantaneous!.

That's just the beginning! With React Static, you can unleash your creativity and build anything you can imagine with speed and productivity. It even has awesome plugins that will help you on your journey!

Coming from Create React App?

React Static is also a great replacement for the ever popular Create React App CLI. It provides a similar developer experience, zero-config environment, and features, but without boxing you in. If you ever need to customize your build system in React Static, there is no need to eject! You can use existing plugins or write your own to customize anything you'd like about the build system. Not building a static site? No worries there, React Static works as an SPA too, even if there is only a single index.html file.

Articles, Videos & Tutorials

Support, Community & Chat

Need some help? Have a quick question? Click here to go to GitHub Discussions! We are constantly answering questions, discussing features and helping each other out!

Contributing, Issues & Bugs

We are always looking for people to help us grow react-static's capabilities and examples. If you have found a bug, or have a feature request let us know! Please follow CONTRIBUTING.md if you want to help out.

License

React Static uses the MIT license. For more information on this license, click here.

react-static's People

Contributors

ajschmidt8 avatar andreme avatar arlair avatar bram-l avatar cinamonas avatar corydeppen avatar crubier avatar d1no avatar danilobuerger avatar danwebb avatar deiga avatar denis-sokolov avatar digitalkaoz avatar dpikt avatar emiltholin avatar hellojere avatar jasonlafferty avatar jviotti avatar krzysztof-pyrzyk-ah avatar lottamus avatar mikestopcontinues avatar nddery avatar pixelatex avatar reggino avatar rywils21 avatar scriptedalchemy avatar sleeplessbyte avatar swyxio avatar tannerlinsley avatar vinnl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-static's Issues

[Question] - How do you handle forms?

Hi, you can totally delete this if you think it is inappropriate but I was wondering how you handle your forms with react-static as it is static content - eg. no server side script to handle form inputs. I'm currently finished building my static website but don't have a clue on how to actually handle form posts.

Are you just sending out fetch or axios requests when somebody submits a form? Or am I missing something obvious here?

Missing dependencies

Hello, great work on this. I'm tinkering with this setup and found some a warning highlight in Atom at the initial React import of the App.js and index.js (I didn't check all container files), notifying that it couldn't find the following dependencies:

  • eslint-plugin-jsx-a11y
  • eslint-plugin-react
  • eslint-plugin-import

Here's what I did to solve it:

yarn add eslint-plugin-jsx-a11y eslint-plugin-react eslint-plugin-import

I'm no longer experiencing these issues after installing those dependencies. Should this be included in the package.json or handled internally within react-static instead?

Magnification kills app.js ? Unexpected Token

image

After building the website, the app.js does not run because it breaks at an odd character

__esModule",{value:!0}),t.B=t.A=t.gb=t.ga=t.รโ€ =void 0;var i=Object.assign||function(e)
                                            ^
                                             \ _ here

Is there something in the encoding not set to UTF-8?

What is the purpose of `react-static-routes`

Is it just a convenience method? Would there be any adverse effects to using a raw <Switch> component instead?

Edit: Which file has the source code for this import? I would like to read the source for myself.

Initial `yarn start` fails when public dir is not created

Hey! Thanks so much for building this! Been vetting all the possible options for using a static site generator on a work project (next, gatsby, spike, etc) and I this is definitely on the table. Prima facie the build seems super fast, which is great.

One minor issue when using the react-static create command. When a given example (IE glamorous) does not have a public dir inside of its root directory, yarn start will throw because it automatically attempts to copy that dir whether it exists or not.

I have a potential PR but can't push, so let me know if / how I can pitch in!

Cheers,

MP

EADDRINUSE / multiple static sites

If we could detect the port being used we wouldn't run into errors like EADDRINUSE associated with port 3000 and we could develop multiple sites at the same time

Basic install fails

Tried starting a basic project

$ react-static start 
=> Copying public directory...
=> [โœ“] Public directory copied: 3.053ms
=> Building...
=> [โœ“] App serving at http://localhost:3000
Failed to rebuild.

Errors
./node_modules/react-proxy/modules/createPrototypeProxy.js
Module not found: Can't resolve 'lodash/assign'
Module not found: Can't resolve 'lodash/difference'
Module not found: Can't resolve 'lodash/find'

./src/App.js
Module not found: Can't resolve 'react-static-routes'
Module not found: Can't resolve 'lodash/difference'

Notes
I tried installing lodash - which fixed that error
I also tried react-static-routes - I looked at the package in the modules dir and it was just a package.json file

problem with terminal

I get this error when installing a new project

The engine "node" is incompatible with this module. Expected version ">=6.9.0".

*Still* not hot reloading

Hello, I'm unsure why my previous issue was closed. I understand changing data will not cause the app to reload but changing CSS, markup, etc should. This is not the case, even with starting with the latest [email protected]. Please advise.

No hot-reload when the app is not served from 3000

Steps to reproduce:

  • Have something already running on port 3000
  • yarn start to serve your react-static app
  • The log should show:
  • => [โœ“] App serving at http://localhost:3001

  • Go to http://localhost:3001, change some text in App.js and save the file

Expected behavior:
The page is reloaded and reflects the changes just made to App.js

Actual behavior:
Nothing happens!

Additional comment
Kill the process running on port 3000, kill the react-static app server and restart it. It should restart on port 3000 and hot-reloading should function as expected.

  • npm 5.4.2
  • node 8.4.0
  • Ubuntu 16.04

Missing public directory

On a fresh project, running npm start: => Copying public directory... (node:29067) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: ENOENT: no such file or directory, stat '/.../my-static-site/public'.

If I manually create the public folder and run again, it works.

CD into target repo when finished creating.

It would be a lot more user-friendly if you auto cd to the created/target repo.

-why? A lot of new programmers will run the create command and receive the commands to start/deploy. And they will instantly run these commands throwing errors because they are still in the parent directory.

Heck, most lazy programmers (like me) would appreciate this.

Implement Create React App's eslint setup

Please consider implementing Eslint which does a much better job of explaining JS errors than browsers do which is helpful for everyone but especially beginners.

Delta builds for very large sites

So, as a POC I have successfully built a static site that has ~100k posts using the built in react-static build which is awesome! Takes about ~45 minutes on my personal, run of the mill MacBook. For the record, out of the box both Gatsby and Next.js would blow up with memory issues before the 10k mark so I am super pumped.

At this point I am doing some research into the best way to be able to update any number of posts and only re-build the delta (or the newly published content). This post data would come from an API call in the static.config.js file, probably something like what exists in the examples. Can anyone offer any insight into the best way of building only the new or updated posts, and leaving the rest of the existing site as is? I was thinking I would have to write a custom build / webpack script for this, but wanted to leverage any existing hooks / infrastructure. I am still looking at other static-site-generators for inspiration, but I figured since someone else will inevitably have a similar use case I wanted to ask here.

Thanks!

Matthew

Big ole' babel warning on installation

Is it OK to proceed as recommended? If so/no, mention in installation doc?

warning react-static > [email protected]: We're super ๐Ÿ˜ธ  excited that you're trying to use ES2017+ syntax, but instead of making more yearly presets ๐Ÿ˜ญ , Babel now has a better preset that we recommend you use instead: npm install babel-preset-env --save-dev. preset-env without options will compile ES2015+ down to ES5 just like using all the presets together and thus is more future proof. It also allows you to target specific browsers so that Babel can do less work and you can ship native ES2015+ to user ๐Ÿ˜Ž ! We are also in the process of releasing v7, so please give http://babeljs.io/blog/2017/09/12/planning-for-7.0 a read and help test it out in beta! Thanks so much for using Babel ๐Ÿ™, please give us a follow on Twitter @babeljs for news on Babel, join slack.babeljs.io for discussion/development and help support the project at opencollective.com/babel

getProps not defined for <Component>

Hi there,

I threw together another markdown renderer this afternoon that I'm going to try and polish up and submit as an example. I'm running into an error I just don't understand the root of though.

I get getProps not defined for: /components/avatar and No route defined for: /components/avatar after spinning up a server with yarn start (npm start produces the same behavior.

Link to the repo.

I'm just stumped and its probably cause I was staring at this for too long.

Not hot reloading

Hi, I was under the impression that saving a file would automatically reload a browser running the site while using react-static start. Is this not the case? Data is changed, I can see that when I manually reload, but the browser does not "hot reload" on it's own when I save any template/data. Please advise. Thanks!

Configurable dist and public folders

I'm trying to use react-static to deploy a site on GitLab Pages. The great thing about GitLab pages compared to GitHub pages is GitLab provides a CI server that can run any static generator to build your site.

However, GitLab requires the website artifacts must be in the /public folder. So I want to build to the /public folder instead of the /dist folder. But there is already a /public folder in react-static. It would be nice if both directories could be configurable. Of course, I can rename/move/copy folders and files, but configurable folder names seems like a reasonable feature of react-static.

Load external CSS

I would like to use external CSS with react-static to migrate from create-react-app completely. Actually it is very straightforward to load fonts via the typefaces packages and then adding them via simple module imports. The problem is that those imports require appropiate css-loaders which are not included inside of react-static.

import 'typeface-montserrat'; // typeface-montserrat/index.css

After a few hours of trying I feel closer to the solution and replaced nearly all webpack loaders with a custom toolchain to support those .css imports, but it still does not work properly. I think it would be a good idea to support css imports out of the box, because the setup is not easy and requires extended knowledge about the project itself & the underlying toolchain.

It seems that you have to add the css-loaders before the file-loader (like in create-react-app), so I had to swap all loaders with a custom configuration in a hacky way. The provided webpackConfigurator gives us no option to insert the loaders in a specific order.

I already tried just using the style-loader and css-loader.

Here is my actual static.config.js:

import NODE_MODULES from 'react-static/dist/paths';

export default {
	[...],
	webpack: (webpackConfigurator, { dev }) => {
		webpackConfigurator._config.module.rules = [];
		webpackConfigurator.merge({
			module: {
				rules: [
					{
						test: /\.(js|jsx)$/,
						exclude: NODE_MODULES,
						use: [
							{
								loader: 'babel-loader',
							},
						],
					},
					{
						test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
						loader: 'url-loader',
						options: {
							limit: 10000,
						},
					},
					{
						test: /\.css$/,
						use: [
							'style-loader',
							{ loader: 'css-loader', options: { importLoaders: 1 } },
							{
								loader: 'postcss-loader',
								options: {
									config: {
										path: './postcss.config.js',
									},
								},
							},
						],
					},
					{
						exclude: [/\.js$/, /\.html$/, /\.json$/],
						loader: require.resolve('file-loader'),
						options: {
							name: '[name].[hash:8].[ext]',
						},
					},
				],
			},
		});
	},
};

I also had to configure postcss properly and install some dependencies. Still it does not work yet:

./node_modules/typeface-montserrat/index.css
Module build failed: Error: Expected a backslash preceding the semicolon.

I will go for sleep now, maybe I will get it working tomorrow. Nevertheless, it would be great if react-static would support this out-of-the-box.

React Static Site

Inception react-static to have live docs & examples hosted by react-static

react-static-routes.js: Octal literal in strict mode

Paths in react-static-routes.js still contain \ on Windows when running react-static start and react-static build commands. It works fine when running npm run start.

Example :
import src_containers____ from 'C:\Users\Alexandre\site\src\containers\404

Problems getting started: unhandled error in events.js:182

I did the following in my terminal...

  1. yarn global add react-static
  2. react-static create
  3. cd
  4. yarn start

and I got...

=> [โœ“] Public directory copied: 8.029ms
=> Building...
events.js:182
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE :::3000
    at Object._errnoException (util.js:1026:11)
    at _exceptionWithHostPort (util.js:1049:20)
    at Server.setupListenHandle [as _listen2] (net.js:1343:14)
    at listenInCluster (net.js:1391:12)
    at Server.listen (net.js:1474:7)
    at Server.listen (/Users/josh/.config/yarn/global/node_modules/webpack-dev-server/lib/Server.js:556:41)
    at startDevServer (/Users/josh/.config/yarn/global/node_modules/react-static/dist/commands/start.js:279:13)
    at _callee4$ (/Users/josh/.config/yarn/global/node_modules/react-static/dist/commands/start.js:356:13)
    at tryCatch (/Users/josh/.config/yarn/global/node_modules/regenerator-runtime/runtime.js:65:40)
    at Generator.invoke [as _invoke] (/Users/josh/.config/yarn/global/node_modules/regenerator-runtime/runtime.js:299:22)```

Did I do something wrong or is this a bug?

I'm on OSX 10.12.5, node v8.5.0, "react-static": "^1.0.43"

first install : Can Start, error : Octal literal in strict mode

Hello, I made a clean install with Yarn and tried
react-static start... unfortunately I had this logs:

$ react-static start
=> Copying public directory...
=> [โœ“] Public directory copied: 7.440ms
=> Building Routes...
=> [โœ“] Routes Built: 283.673ms
=> Building...
=> [โœ“] App serving at http://localhost:3000
Failed to rebuild.
./dist/react-static-routes.js
Syntax error: D:/projects/react-static/constraintsolver/dist/react-static-routes.js: Octal literal in strict mode (9:89)
7 | import src_containers_Post from 'D:\projects\react-static\constraintsolver\src\containers\Post'
8 | import src_containers_Blog from 'D:\projects\react-static\constraintsolver\src\containers\Blog'
> 9 | import src_containers____ from 'D:\projects\react-static\constraintsolver\src\containers\404'
10 |
11 | export default class Routes extends Component {
12 | render () {

any idea ?
Thanks !

Error while building

When I used react-static create to create the sample application and selected basic template, I get this error when I ran yarn build

ERROR in ./src/App.js
Module not found: Error: Can't resolve 'react-static-routes' in '/Users/Zama/Desktop/passion/my-static-site/src'
 @ ./src/App.js 13:25-55
 @ ./src/index.js
 @ multi ./src/index

=> There were ERRORS during the production build stage! :(
=> Fix them and try again!

and when I selected custom routing, I got this error

TypeError: (0 , _reactStatic.getSiteProps) is not a function
    at Object.<anonymous> (/Users/Zama/Desktop/passion/custom-static-site/src/containers/Home.js:4:16)
    at Module._compile (module.js:570:32)
    at loader (/Users/Zama/Desktop/passion/custom-static-site/node_modules/babel-register/lib/node.js:144:5)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/Zama/Desktop/passion/custom-static-site/node_modules/babel-register/lib/node.js:154:7)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/Zama/Desktop/passion/custom-static-site/src/App.js:4:1)

RangeError: Invalid string length

I'm seeing this stack trace (only in development mode) when trying to generate a site with a lot of routes (~6000)

RangeError: Invalid string length
    at Object.stringify (native)
    at stringify (/Users/mike/workspace/react-static-test/node_modules/express/lib/response.js:1119:12)
    at ServerResponse.json (/Users/mike/workspace/react-static-test/node_modules/express/lib/response.js:260:14)
    at _callee3$ (/Users/mike/workspace/react-static-test/node_modules/react-static/dist/commands/start.js:133:29)
    at tryCatch (/Users/mike/workspace/react-static-test/node_modules/regenerator-runtime/runtime.js:65:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/Users/mike/workspace/react-static-test/node_modules/regenerator-runtime/runtime.js:299:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Users/mike/workspace/react-static-test/node_modules/regenerator-runtime/runtime.js:117:21)
    at step (/Users/mike/workspace/react-static-test/node_modules/react-static/dist/commands/start.js:238:191)
    at /Users/mike/workspace/react-static-test/node_modules/react-static/dist/commands/start.js:238:361
    at process._tickCallback (internal/process/next_tick.js:109:7)

This is occurring on the call to the getroutes endpoint. If I reduce the number of routes down to around 1000, you can see that the response from getroutes is fairly large (15.6 MB)

screen shot 2017-10-11 at 6 53 05 am

It looks like this is happening because each route in the returned object includes it's parent which includes all of it's children so the size of the response grows very quickly if a route has a lot of children. Somewhere in the code is probably calling JSON.stringify on this object and it's so large that it's throwing the error.

screen shot 2017-10-11 at 6 53 59 am

Would it be possible to remove the children field from parent?

Unable to import images from src folder

Currently trying to import images, but without extra configuration am unable to get it to build.

...
=> [โœ“] App Bundled: 3521.463ms
=> Exporting Routes...
{ SyntaxError: /Users/malonehedges/projectPath/src/assets/myimage.png: Unexpected character '๏ฟฝ' (1:0)
> 1 | ๏ฟฝPNG
    | ^
...

"Add example configuring webpack to import images from the src folder"?

Builds fail for components requiring `window`

Hi there!

Really great work on this, very nice alternative to Next + Gatsby and very slick. I've been getting errors on my build, I have 2 components that need the browsers window object and they crash the build process, I've tried a few different thinks like ErrorBoundary etc. My project runs just fine in the dev environment (minus my font but ill get to that later).

Here is the error: ReferenceError: window is not defined

Here is the Repo

Anyway, thanks for this killer project, deff gonna use this for some more things in the future.

where to include google analytics code

Dear Friends,

when i am adding analytic code in Tag showing following error:
/home/gmchaturvedi/Documents/ProductionApps/go4edu/go4edu/node_modules/babel-core/lib/transformation/file/index.js:590
throw err;
^

SyntaxError: /home/gmchaturvedi/Documents/ProductionApps/go4edu/go4edu/static.config.js: Unexpected token, expected } (80:59)
78 |
79 | <script>

80 | (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
| ^
81 | (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
82 | m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
83 | })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
at Parser.pp$5.raise (/home/gmchaturvedi/Documents/ProductionApps/go4edu/go4edu/node_modules/babylon/lib/index.js:4454:13)
at Parser.pp.unexpected (/home/gmchaturvedi/Documents/ProductionApps/go4edu/go4edu/node_modules/babylon/lib/index.js:1761:8)
at Parser.pp.expect (/home/gmchaturvedi/Documents/ProductionApps/go4edu/go4edu/node_modules/babylon/lib/index.js:1749:33)
at Parser.pp$9.jsxParseExpressionContainer (/home/gmchaturvedi/Documents/ProductionApps/go4edu/go4edu/node_modules/babylon/lib/index.js:7121:8)
at Parser.pp$9.jsxParseElementAt (/home/gmchaturvedi/Documents/ProductionApps/go4edu/go4edu/node_m

Add example that shows TypeScript usage

Our components are all written in TypeScript. Is there support for using TypeScript and possibly typings for react-static?

Glad to have an alternative to next.js and would love to switch.

Great Work!
Dino

Can't use fs module in the static.config.js file

I wanted to create markdown files inside a folder, but when I tried to use the fs module (or fs-extra) the build process fails.
Minimum steps:
Add import fs from 'fs' to the static.config.js file
$ yarn start
screen shot 2017-10-07 at 3 56 49 pm

Cannot find module 'react-static-routes' on Windows

Using version react-static 1.4.1 on Windows 10, I get an error on yarn build. It doesn't occur on yarn start.

D:\Code 
ฮป react-static create

? What should we name this project? test-www
? Select a template below... styled-components
=> Creating new react-static project...
=> Installing dependencies...

...

=> [โœ“] Project "test-www" created: 41882.103ms

=> To get started:

cd test-www

yarn start - Start the development server
yarn build - Build for production
yarn serve - Test a production build locally


D:\Code 
ฮป cd test-www

D:\Code\test-www  ([email protected])
ฮป yarn build
yarn build v1.0.0
$ react-static build

=> Copying public directory...
=> [โœ“] Public directory copied: 1.851ms
=> Building Routes...
=> [โœ“] Routes Built: 97.737ms
=> Bundling App...
=> [โœ“] App Bundled: 3563.956ms
=> Exporting Routes...
{ Error: Cannot find module 'react-static-routes'
    at Function.Module._resolveFilename (module.js:527:15)
    at Function.Module._load (module.js:476:23)
    at Module.require (module.js:568:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (D:/Code/playbook-www/src/App.js:5:1)
    at Module._compile (module.js:624:30)
    at loader (D:\Code\playbook-www\node_modules\babel-register\lib\node.js:144:5)
    at Object.require.extensions.(anonymous function) [as .js] (D:\Code\playbook-www\node_modules\babel-register\lib\node.js:154:7)
    at Module.load (module.js:545:32)
    at tryModuleLoad (module.js:508:12) code: 'MODULE_NOT_FOUND' }
error Command failed with exit code 1.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.