Skip to content

Commit

Permalink
Fixes my stupid mistake of pusing react-universally-skinny into the r…
Browse files Browse the repository at this point in the history
…epo.
  • Loading branch information
ctrlplusb committed Jul 19, 2016
1 parent 477d778 commit 6127b28
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 35 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# Change Log
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [1.0.0] - 2016-07-18

### Added
Version 1 of the react-universally boilerplate. From here on out we are all
about semantic versioning with a clear recording of all changes made to the
project.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ The application configuration is supported by the `dotenv` module and it require

### [`react-universally-skinny`](https://github.com/ctrlplusb/react-universally-skinny)

When size matters. A lightweight alternative to `react-universally`. Provides over ___60% bundle output savings___!
When size matters. A lightweight alternative to `react-universally`. Provides over 60% bundle output savings!

### [`advanced-boilerplate`](https://github.com/sebastian-software/advanced-boilerplate)

Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
"express": "4.14.0",
"helmet": "2.1.1",
"hpp": "0.2.1",
"preact": "5.4.0",
"preact-compat": "git+https://github.com/ctrlplusb/preact-compat.git#2.0.1_release-waiting",
"react-router": "3.0.0-alpha.1",
"react": "15.2.1",
"react-dom": "15.2.1",
"react-router": "2.6.0",
"serialize-javascript": "1.3.0",
"source-map-support": "0.4.2"
},
Expand All @@ -64,6 +64,7 @@
"node-notifier": "4.6.0",
"normalize.css": "4.2.0",
"path": "0.12.7",
"react-hot-loader": "3.0.0-beta.2",
"rimraf": "2.5.3",
"style-loader": "0.13.1",
"webpack": "2.1.0-beta.19",
Expand Down
24 changes: 9 additions & 15 deletions src/client/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import { render } from 'react-dom';
import { AppContainer } from 'react-hot-loader';
import Router from 'react-router/lib/Router';
import browserHistory from 'react-router/lib/browserHistory';
import match from 'react-router/lib/match';
Expand All @@ -18,22 +19,15 @@ function renderApp() {
console.log('==> 😭 React Router match failed.'); // eslint-disable-line no-console
}

if (process.env.NODE_ENV === 'development' && module.hot) {
// Preact's default behaviour is to append to the container, rather than
// replace existing content like in React. The Preact Compat is supposed
// to emulate React's behaviour however it seems to be having problems
// with this dynamic routing configuration, therefore we manually clear
// out our container before doing any rendering.
while (container.firstChild) {
container.removeChild(container.firstChild);
}
}

render(
// We need to explicly render the Router component here instead of have
// this embedded within a shared App type of component as we use different
// router base components for client vs server rendering.
<Router {...renderProps} />,
<AppContainer>
{/*
We need to explicly render the Router component here instead of have
this embedded within a shared App type of component as we use different
router base components for client vs server rendering.
*/}
<Router {...renderProps} />
</AppContainer>,
container
);
});
Expand Down
26 changes: 10 additions & 16 deletions webpackConfigFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,11 @@ function webpackConfigFactory({ target, mode }, { json }) {
// webpack to process, therefore we lie to the 'webpack-node-externals'
// and list these as binaries which will make sure they don't get
// added to the externals list.
// If you have a library dependency that depends on a webpack loader
// then you will need to add it to this list.
binaryDirs: [
// We want 'normalize.css' to be processed by our css loader.
'normalize.css',
// We need react and react-dom here as they are aliased by our
// webpack configuration.
'react',
'react-dom',
// List out any libraries that you depend on here, which have a
// dependency on react. This is so that their react dependency
// can be aliased to preact-compat.
'react-router',
],
})),
]),
Expand All @@ -133,6 +127,7 @@ function webpackConfigFactory({ target, mode }, { json }) {
entry: merge(
{
main: removeEmpty([
ifDevClient('react-hot-loader/patch'),
ifDevClient(`webpack-hot-middleware/client?reload=true&path=http://localhost:${process.env.CLIENT_DEVSERVER_PORT}/__webpack_hmr`),
path.resolve(__dirname, `./src/${target}/index.js`),
]),
Expand Down Expand Up @@ -174,14 +169,6 @@ function webpackConfigFactory({ target, mode }, { json }) {
'.jsx',
'.json',
],
// We alias out our react dependencies and replace them with the
// lightweight preact library.
// @see https://github.com/developit/preact-compat
alias: {
react: 'preact-compat',
'react-dom': 'preact-compat',
'react-dom/server': 'preact-compat',
},
},
plugins: removeEmpty([
// Each key passed into DefinePlugin is an identifier.
Expand Down Expand Up @@ -270,6 +257,13 @@ function webpackConfigFactory({ target, mode }, { json }) {
loader: 'babel-loader',
exclude: [/node_modules/, path.resolve(__dirname, './build')],
query: merge(
{
env: {
development: {
plugins: ['react-hot-loader/babel'],
},
},
},
ifServer({
// We are running a node 6 server which has support for almost
// all of the ES2015 syntax, therefore we only transpile JSX.
Expand Down

0 comments on commit 6127b28

Please sign in to comment.