Giter Site home page Giter Site logo

nicksp / redux-webpack-es6-boilerplate Goto Github PK

View Code? Open in Web Editor NEW
561.0 30.0 128.0 144 KB

A starter project for modern React apps with Redux

License: MIT License

CSS 3.34% HTML 1.38% JavaScript 95.28%
react boilerplate react-boilerplate redux redux-boilerplate webpack2 react-router flow tdd-workflow tdd

redux-webpack-es6-boilerplate's Introduction

React + Redux w/ ES6 Starter Project

πŸŽ‰ A Completely updated version of my initial boilerplate πŸš€

Note: If you still want to use a previous version, please checkout old-original-structure branch.

A boilerplate using the power and simplicity of React, Redux, Webpack 2 + HMR, and ES6 + JSX via Babel. Includes Webpack's Tree Shaking configuration. It's suitable for scalable applications and organized using the custom variation of the Ducks pattern β€” approach when each module's entry file (feature-name.js) contains all of its related constants, actions/action creators, selectors and its reducer.

The provided boilerplate is powered by the following technology stack:

  • React and JSX β€” a virtual DOM JavaScript library for rendering UI. It's about rendering view as a function of state, making JavaScript-driven UI declarative the way HTML is declarative.
  • Redux β€” an incredibly simple way of modelling your data app state, with great community support
  • Webpack 2 and dev middleware β€” client-side module builder and module loader
  • React Hot Loader 3 β€” combines the best of React Hot Loader and React Transform and fixes some long-standing issues
  • React Router v3 β€” to allow dynamic routing
  • React Router Redux β€” simple bindings to keep React Router and Redux in sync
  • Reselect β€” provides a way to access Redux state in components and build composable selectors that are automatically memoized
  • Flow β€” static type checker for JavaScript aimed at catching common bugs in JavaScript programs. The flow type annotations get ripped out of the source by the webpack build step. You have no obligation to use flow within your code and can even uninstall the dependency (flow-bin) without breaking the project.
  • npm β€” package manager and task runner
  • Babel 6 β€” transpiler from ES6 / JSX to ES5
  • PostCSS β€” ecosystem of custom plugins and tools aimed at transforming extended syntaxes and features into modern, browser-friendly CSS
  • CSS Modules β€” guarantee that all the styles for a single component, designed to fix the problem of the global scope in CSS
  • Redux DevTools β€” a live-editing environment for your Redux apps (and as a browser extension)
  • webpack-dashboard β€” CLI dashboard for your Webpack dev server
  • React Intl β€” internationalization for React projects
  • ESLint β€” reporter for syntax and style issues
  • eslint-plugin-react & eslint-plugin-flowtype β€” additional React/Flow type specific linting rules for ESLint
  • Sass β€” compiler of CSS styles with variables, mixins, and more
  • Mocha β€” well-known and flexible test framework that you can use to run your JavaScript tests on the server or in the browser
  • Enzyme β€” makes unit testing React components an absolute pleasure
  • Chai β€” BDD assertion library that works along with Mocha
  • Sentry β€” real-time error tracking for your app

Getting Started

Prerequisites

Support for Node.js > 5

Installation

$ git clone https://github.com/nicksp/redux-webpack-es6-boilerplate.git app-name
$ cd app-name
$ npm install

White Label It

Development

There are two ways in which you can build and run the web app:

  • Build once for (ready for Production):

    • $ npm run build
    • $ npm run build:serve

    The last command will boot up HTTP server on 3003 port and serve build/client directory in a default browser

  • Hot reloading via webpack middlewares:

    • $ npm start
    • Point your browser to http://localhost:3000/, page hot reloads automatically when there are changes

Testing

(TBD)

To execute all unit tests, use:

$ npm run test

To run unit tests continuously during development (watch tests), use:

$ npm run test:watch

Expose App on Your Local Dev Machine

Assign yourself a unique publicly accessible url that will proxy all requests to your locally running webserver.

$ npm install -g localtunnel
$ npm start
$ npm run tunnel # run in a new tab

You will receive a url, for example https://tbst.localtunnel.me, that you can share with anyone for as long as your local instance of lt remains active. Any requests will be routed to your local service at the specified port.

Error Tracking and Insights with Sentry

In order to get info on errors that happened in production, we integrate Sentry into our application to track errors and get context on what happened.

To use it on your side, configure it first:

  • Create account at https://sentry.io/signup/
  • Add new project for your app on Sentry website
  • In /src/client/assets/javascripts/app/config.js file assign SENTRY_KEY and SENTRY_APP constants values that you got after adding a new project
  • Don't forget to define Allowed Domains section under your Project Settings on Sentry website to track errors from required domains

Debugging

For debugging purposes please use:

FAQ

What's this for?

This starter kit implements best practices like testing (unit testing), minification, bundling, and so on. It saves you from the long, painful process of wiring it all together into an automated dev environment and build process.

What's happening under the hood when I run npm start?

Webpack serves your app in memory when you run npm start. No physical files are written. However, the web root is /src, so you can reference files under /src in index.html. When the app is built using npm run build, physical files are written to /build folder and the app is served from /build.

How is Sass being processed?

We're handling it differently in DEV vs PROD.

When you run npm start:

  1. The sass-loader compiles Sass into CSS
  2. Webpack bundles the compiled CSS into app.js. Sounds weird, but it works!
  3. app.js contains code that loads styles into the <head> section of index.html via JavaScript. This is why there is no stylesheet reference in index.html. In fact, if you disable JavaScript in your browser, you'll see the styles don't load either.

The approach above supports hot reloading, which is great for development. However, it also create a flash of unstyled content on load because you have to wait for the JavaScript to parse and load styles before they're applied. So for the production build, we use a different approach:

When you run npm run build:

  1. The sass-loader compiles Sass into CSS
  2. The extract-text-webpack-plugin extracts the compiled Sass into app.css
  3. buildHtml.js adds a reference to the stylesheet to the head of index.html.

How do I deploy this?

npm run build. This will prepare and build the project for production use. It does the following:

  • Minifies all JS and CSS
  • Inline base64 URLs for images and fonts if their size is less than specified limit
  • Sets NODE_ENV to production so that React is built in production mode
  • Places the resulting built project files into /build directory. (This is the folder you'll expose to the world).

TODO

  • Watch index.html for changes
  • Setup test environment for React components using Enzyme, Mocha and Karma
  • Add support for React Intl
  • Add support for dynamic routing (code splitting)
  • Update FAQ section to reflect latest greatest changes
  • Add more Flow type annotations incrementally to allow Flow to validate more code, and gradually increase Flow’s coverage of the codebase
  • Integrate Material Design or Bootstrap
  • Check if PostCSS integration works
  • Apply more best practices to how code is organized and written
  • Add section about available npm scripts
  • Any more ideas?

License

MIT License, 2016

Brought to you by Nick S. Plekhanov

redux-webpack-es6-boilerplate's People

Contributors

amilajack avatar andrepcg avatar andyklimczak avatar hassankhan avatar interstelios avatar llearn avatar nicksp avatar ranjithnair 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

redux-webpack-es6-boilerplate's Issues

Warning vendor.bundle.js

Hello
I got this error when launching my project.The project is based on this starter template.
erreur

Don't you want to add Immutable.js?

Hey, great job! I've currently started 2 projects on your boilerplate. It's great, I love the structure of code and selected tools. Only things what I change is get rid of flow and "models" folder and add Immutable.Js. Why do you need models? For flow? If reducer, actions, selector, constants are in one place, why the structure of the initial state is somewhere else?

On features/X/x.js i define initialState like this:

const initialState = Immutable.Map({
  loading: false,
  channels: Immutable.Map({
    channels: Immutable.Set(),
    product_id: null,
    error: null,
  }),
  product_id: null,
  error: null,
});

and in the component, I can have super quick check of the immutable structure

  shouldComponentUpdate(nextProps, nextState, nextContext) {
    return (
      !Immutable.is(this.props.countries, nextProps.countries)
    );
  }

I've used Immutable.js for months before and it was always great. I suggest to try it out. Flow can be used with Immutable too, but I don't feel, that I need flow in the 1st place. I would if I would work on the huge app, though.

styles/styles.scss imported twice?

styles/styles.scss is imported in both each entry point (development.js, production.js), and in app/index.js. Is there a reason for that?

Support for PostCSS

Hi @nicksp,

I was wondering if the boilerplate supports or intends to support either PostCSS or styled-components instead of plain SASS? Or is there a recipe or a guide to switch one out for the other?

Thank you for putting out this boilerplate!

Fonts not showing up on development server

Hello,

I realized while using this boilerplate that I couldn't get the fonts to work correctly when running the webpack dev server. The demo doesn't seem to be rendering the Open Sans font. I haven't checked if the fonts are working in the production build. I played around with the config and using different paths but couldn't get it working :( Maybe you can help!!

Thanks!

Font-face import causes build to fail

in /src/styles.style.scss addding a font face declaration like:

@font-face {
font-weight: normal;
font-style: normal;
font-family: 'icomoon';
src:url('../fonts/icomoon/icomoon.eot?u58ytb');
src:url('../fonts/icomoon/icomoon.eot?#iefixu58ytb') format('embedded-opentype'),
url('../fonts/icomoon/icomoon.woff?u58ytb') format('woff'),
url('../fonts/icomoon/icomoon.ttf?u58ytb') format('truetype'),
url('../fonts/icomoon/icomoon.svg?u58ytb#icomoon') format('svg');
}

Causes build errors, example:
ERROR in ./src/fonts/icomoon/icomoon.eot?u58ytb
Module parse failed: C:\Users\jmasse\Documents\sites\redux-webpack-es6-boilerplate-master\src\fonts\icomoon\icomoon.eot?u58ytb Unexpected c
haracter 'ΒΆ' (1:0)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected character 'ΒΆ' (1:0)
at Parser.pp.raise (C:\Users\jmasse\Documents\sites\redux-webpack-es6-boilerplate-master\node_modules\webpack\node_modules\acorn\dist\a
corn.js:920:13)
at Parser.pp.getTokenFromCode (C:\Users\jmasse\Documents\sites\redux-webpack-es6-boilerplate-master\node_modules\webpack\node_modules\a
corn\dist\acorn.js:2813:8)
at Parser.pp.readToken (C:\Users\jmasse\Documents\sites\redux-webpack-es6-boilerplate-master\node_modules\webpack\node_modules\acorn\di
st\acorn.js:2508:15)
at Parser.pp.nextToken (C:\Users\jmasse\Documents\sites\redux-webpack-es6-boilerplate-master\node_modules\webpack\node_modules\acorn\di
st\acorn.js:2500:71)
at Parser.parse (C:\Users\jmasse\Documents\sites\redux-webpack-es6-boilerplate-master\node_modules\webpack\node_modules\acorn\dist\acor
n.js:1615:10)
at Object.parse (C:\Users\jmasse\Documents\sites\redux-webpack-es6-boilerplate-master\node_modules\webpack\node_modules\acorn\dist\acor
n.js:882:44)
at Parser.parse (C:\Users\jmasse\Documents\sites\redux-webpack-es6-boilerplate-master\node_modules\webpack\lib\Parser.js:902:15)
at DependenciesBlock. (C:\Users\jmasse\Documents\sites\redux-webpack-es6-boilerplate-master\node_modules\webpack\lib\NormalM
odule.js:104:16)
at DependenciesBlock.onModuleBuild (C:\Users\jmasse\Documents\sites\redux-webpack-es6-boilerplate-master\node_modules\webpack-core\lib
NormalModuleMixin.js:310:10)
at nextLoader (C:\Users\jmasse\Documents\sites\redux-webpack-es6-boilerplate-master\node_modules\webpack-core\lib\NormalModuleMixin.js:
275:25)
at C:\Users\jmasse\Documents\sites\redux-webpack-es6-boilerplate-master\node_modules\webpack-core\lib\NormalModuleMixin.js:259:5
at Storage.finished (C:\Users\jmasse\Documents\sites\redux-webpack-es6-boilerplate-master\node_modules\enhanced-resolve\lib\CachedInput
FileSystem.js:38:16)
at C:\Users\jmasse\Documents\sites\redux-webpack-es6-boilerplate-master\node_modules\graceful-fs\graceful-fs.js:78:16
at FSReqWrap.readFileAfterClose as oncomplete
@ .//css-loader?sourceMap!.//postcss-loader!./~/sass-loader?outputStyle=compressed!./src/styles/styles.scss 6:103-149

npm run test - SyntaxError: Unexpected token import

Pulled the project down and everything is working great so far. However, npm run test is πŸ’₯ .

All of the other commands before that in the ReadMe are fine, build, build:serve, npm start. But when I get to the test, no luck.

console error

$ npm run test

> [email protected] test C:\projects\git-stats
> mocha --compilers js:babel-core/register,css:./test/unit/cssNullCompiler.js --require ./test/unit/testHelper.js --recursive ./test/unit

C:\projects\git-stats\test\unit\testHelper.js:1
(function (exports, require, module, __filename, __dirname) { import jq from 'jquery';
                                                              ^^^^^^
SyntaxError: Unexpected token import
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at loader (C:\projects\git-stats\node_modules\babel-register\lib\node.js:144:5)
    at Object.require.extensions.(anonymous function) [as .js] (C:\projects\git-stats\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 C:\projects\git-stats\node_modules\mocha\bin\_mocha:310:3
    at Array.forEach (native)
    at Object.<anonymous> (C:\projects\git-stats\node_modules\mocha\bin\_mocha:309:10)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:389:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:504:3

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "test"
npm ERR! node v6.11.0
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] test: `mocha --compilers js:babel-core/register,css:./test/unit/cssNullCompiler.js --require ./test/unit/testHelper.js --recursive ./test/unit`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] test script 'mocha --compilers js:babel-core/register,css:./test/unit/cssNullCompiler.js --require ./test/unit/testHelper.js --recursive ./test/unit'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the git-stats package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     mocha --compilers js:babel-core/register,css:./test/unit/cssNullCompiler.js --require ./test/unit/testHelper.js --recursive ./test/unit
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs git-stats
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls git-stats
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\projects\git-stats\npm-debug.log

npm-debug.log

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'test' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'pretest', 'test', 'posttest' ]
5 info lifecycle [email protected]~pretest: [email protected]
6 silly lifecycle [email protected]~pretest: no script for pretest, continuing
7 info lifecycle [email protected]~test: [email protected]
8 verbose lifecycle [email protected]~test: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]~test: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;C:\projects\git-stats\node_modules\.bin;C:\cmder\bin;C:\cmder\vendor\conemu-maximus5\ConEmu\Scripts;C:\cmder\vendor\conemu-maximus5;C:\cmder\vendor\conemu-maximus5\ConEmu;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\CCM;C:\Windows\CCM;C:\Windows\CCM;C:\Windows\CCM;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Microsoft SQL Server\120\Tools\Binn;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn;C:\Program Files\Microsoft\Web Platform Installer;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn;C:\Program Files (x86)\Yarn\bin;C:\Program Files\dotnet;C:\Program Files\nodejs;C:\Program Files\Microsoft SQL Server\120\DTS\Binn;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\WindowsPowerShell\v1.0;C:\ProgramData\chocolatey\lib\eh.flyway.commandline\tools\flyway-4.2.0;C:\ProgramData\chocolatey\lib\eh.flyway.commandline\tools\flyway-4.2.0\drivers;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn;C:\Ruby193\bin;C:\Users\domipe\AppData\Local\atom\bin;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Users\domipe\AppData\Local\Yarn\.bin;C:\phantomjs-2.1.1-windows\bin;C:\Program Files\Docker Toolbox;C:\Users\domipe\AppData\Roaming\npm;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\share\vim\vim74;C:\cmder
10 verbose lifecycle [email protected]~test: CWD: C:\projects\git-stats
11 silly lifecycle [email protected]~test: Args: [ '/d /s /c',
11 silly lifecycle   'mocha --compilers js:babel-core/register,css:./test/unit/cssNullCompiler.js --require ./test/unit/testHelper.js --recursive ./test/unit' ]
12 silly lifecycle [email protected]~test: Returned: code: 1  signal: null
13 info lifecycle [email protected]~test: Failed to exec test script
14 verbose stack Error: [email protected] test: `mocha --compilers js:babel-core/register,css:./test/unit/cssNullCompiler.js --require ./test/unit/testHelper.js --recursive ./test/unit`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:255:16)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at EventEmitter.emit (events.js:191:7)
14 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at ChildProcess.emit (events.js:191:7)
14 verbose stack     at maybeClose (internal/child_process.js:891:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid [email protected]
16 verbose cwd C:\projects\git-stats
17 error Windows_NT 6.1.7601
18 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "test"
19 error node v6.11.0
20 error npm  v3.10.10
21 error code ELIFECYCLE
22 error [email protected] test: `mocha --compilers js:babel-core/register,css:./test/unit/cssNullCompiler.js --require ./test/unit/testHelper.js --recursive ./test/unit`
22 error Exit status 1
23 error Failed at the [email protected] test script 'mocha --compilers js:babel-core/register,css:./test/unit/cssNullCompiler.js --require ./test/unit/testHelper.js --recursive ./test/unit'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the git-stats package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     mocha --compilers js:babel-core/register,css:./test/unit/cssNullCompiler.js --require ./test/unit/testHelper.js --recursive ./test/unit
23 error You can get information on how to open an issue for this project with:
23 error     npm bugs git-stats
23 error Or if that isn't available, you can get their info via:
23 error     npm owner ls git-stats
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

built failed: Nodejs 6.9.1 in Ubuntu 16.10

I'm running nodejs(6.9.1) and npm(4.0.2) which are last stable versions available.
I have run this project in 2 different machines, one has a mac OS(el capitan) and the other has Ubuntu 16.10 installed.
Both are running the same npm and nodejs version.
Somehow when I run npm run build/start in the mac everything is fine but in the Linux one I get this error:

ERROR in ./src/client/assets/javascripts/app/index.js
Module build failed: SyntaxError: Unexpected token (22:2)

>   20 | // Render the React application to the DOM
>   21 | render(
> > 22 |   <AppContainer errorReporter={Redbox}>
>      |   ^
>   23 |     <Root store={store} history={history} />
>   24 |   </AppContainer>,
>   25 |   rootEl
> 

This is what fails in those npm run commands:
cross-env NODE_ENV=production webpack --config ./config/webpack.config.production.js --progress

HMR works in components and reducers but not in actions

Hi, maybe I am missing something, but I cannot get HMR to work inside actions:
npm install
npm start

then modify friend.js
function addFriend(name: string) {
return {
type: ADD_FRIEND,
name:NAME+" XXXX"
};
}

but after this change the new friend's name are still added without XXXX

If I refresh the page, the change is taken into account, so it seems to be a problem in HMR?

Webpack differences between dev and prod

I'm trying to use Bootstrap from my node_modules folder instead of the provided one in styles. This works fine when running npm start, but when I run npm run build, it fails, saying I need an appropriate loader.

It seems that CSS handling is different somehow between the configuration options, I'm guessing its the ExtractPlugin doing something odd.

Heroku deployment

Just started working on this starter.

How do you push this to heroku?
Do I have to create a prod-sever.js and configure there and then use that in a newly created Procfile? Are there any other set ups i need to do? Here is my current prod-server.js.

const express = require('express');
const path = require('path');
const port = process.env.PORT || 8080;

const app = express();

app.use(express.static('build'));

app.get('*', (req, res) => {
  res.sendFile(path.join(__dirname, 'build/client/index.html'));
});

app.listen(port, () => {
  console.log("Party started on port "+port);
})

Thanks

Fix For imports? Style Polyfill

I tried adding firebase to this boilerplate and got the following error when fetch was called.

Can't resolve 'imports?this=>global' in '.../node_modules/firebase'

I believe the offending line is here:
https://github.com/nicksp/redux-webpack-es6-boilerplate/blob/master/config/webpack.config.base.js#L27

Installing imports-loader and exports-loader resolved the issue. I.e.

npm i imports-loader exports-loader -D

I found this solution here:
http://mts.io/2015/04/08/webpack-shims-polyfills/

Empty App = blank page

Hi, I've been using this boilerplate for 2/3 weeks to make a blog and learn React. Today, I was playing with the font awesome and at one point everything disappeared and the

is empty in the DevTools

Any ideas?

Discussion: Split features/friends into separate files

It feels like a lot to take in, I do agree with the module structure in general but could we perhaps separate the action creators, types and reducer?

Also, shouldn't the model for each feature be in the same folder as well?

Discussion: Tests

I see Enzyme's mentioned, which is awesome. Can we keep all tests under test/, keeps things simpler?

Also it seems Jest is back in vogue, I haven't used it at all but happy to give it a shot.

npm run test fails on import

running npm run test outputs:

Β± npm run test

> [email protected] test /Users/mikej/Documents/glcode/picsa-core-web
> mocha --compilers js:babel-core/register,css:./test/unit/cssNullCompiler.js --require ./test/unit/testHelper.js --recursive ./test/unit

/Users/mikej/Documents/glcode/picsa-core-web/test/unit/testHelper.js:1
(function (exports, require, module, __filename, __dirname) { import jq from 'jquery';
                                                              ^^^^^^
SyntaxError: Unexpected token import
    at Object.exports.runInThisContext (vm.js:76:16)
    at Module._compile (module.js:528:28)
    at loader (/Users/mikej/Documents/glcode/picsa-core-web/node_modules/babel-register/lib/node.js:146:5)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/mikej/Documents/glcode/picsa-core-web/node_modules/babel-register/lib/node.js:156:7)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at /Users/mikej/Documents/glcode/picsa-core-web/node_modules/mocha/bin/_mocha:310:3
    at Array.forEach (native)
    at Object.<anonymous> (/Users/mikej/Documents/glcode/picsa-core-web/node_modules/mocha/bin/_mocha:309:10)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.runMain (module.js:590:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3

npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/Cellar/node/6.5.0/bin/node" "/usr/local/bin/npm" "run" "test"
npm ERR! node v6.5.0
npm ERR! npm  v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! [email protected] test: `mocha --compilers js:babel-core/register,css:./test/unit/cssNullCompiler.js --require ./test/unit/testHelper.js --recursive ./test/unit`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] test script 'mocha --compilers js:babel-core/register,css:./test/unit/cssNullCompiler.js --require ./test/unit/testHelper.js --recursive ./test/unit'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the picsa-core-web package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     mocha --compilers js:babel-core/register,css:./test/unit/cssNullCompiler.js --require ./test/unit/testHelper.js --recursive ./test/unit
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs picsa-core-web
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls picsa-core-web
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/mikej/Documents/glcode/picsa-core-web/npm-debug.log```

Requires NodeJS current

Does not work with Node LTS (v4.4.4), had to install the latest. Can you update the docs?

Routing fails on production build

When running npm start and and navigating to, say, http://localhost:3000/some-page I get to the route I defined in routes.js or the default 404. that's good.
After building for production with npm run build and serving with npm run build:serve the main http://127.0.0.1:3003/ works but all other routes fail, giving browser 404 - This 127.0.0.1 page can’t be found.

Sorry if I'm missing something obvious.

node-sass should be update to 3.7.0

node-sass should be update to 3.7.0, or it will throw ObjectTemplate::Set() with non-primitive values is deprecated exception. see sass/node-sass#1484

and when run build, it will throw

> [email protected] build /Users/lihuazhang/code/React/redux-demo
> SET NODE_ENV=production & NODE_ENV=production & webpack -p --config ./config/webpack.config.prod.js --progress

sh: SET: command not found

so

diff --git a/package.json b/package.json
index 2a77f87..48c968b 100644
--- a/package.json
+++ b/package.json
@@ -26,7 +26,7 @@
     "prestart": "node ./bin/clean.js",
     "start": "webpack-dev-server --config ./config/webpack.config.dev.js --hot --inline --progress",
     "prebuild": "npm run clean:build && npm run build:html",
-    "build": "SET NODE_ENV=production& NODE_ENV=production& webpack -p --config ./config/webpack.config.prod.js --progress",
+    "build": "export NODE_ENV=production & NODE_ENV=production & webpack -p --config ./config/webpack.config.prod.js --progress",
     "lint": "eslint config src/js/** --ext .js",
     "jscs": "jscs src/js/",
     "test": "mocha --compilers js:babel-core/register,css:./test/unit/cssNullCompiler.js --require ./test/unit/testHelper.js --recursive ./test/unit",
@@ -53,7 +53,7 @@
     "jscs": "2.10.1",
     "jsdom": "8.2.0",
     "mocha": "2.4.5",
-    "node-sass": "3.6.0",
+    "node-sass": "3.7.0",
     "postcss-loader": "0.8.2",
     "react-addons-test-utils": "15.0.1",
     "react-hot-loader": "1.3.0",

production build images processing

app can't get images.

  1. each images replaced to build/images/... --> all ok.
  2. take build and load to server, open www.somemyserver.com/projects/myapp

images doesn't loaded!((
css and js doesn't loaded(( (fixed with changes inside index.html --> ( **/**js/app.js to js/app.js ))

img src inside chrome devtools - images/stamp.png --> looks ok! i have this image inside build/images/stamp.png

and every time i am running with 404 (((

DockMonitor not set up properly

DockMonitor is not set up properly. I get errors like this out of the box.

Warning: Failed propType: Required prop monitorState.position was not specified in DockMonitor. Check the render method of Connect(DockMonitor).

Windows support

Running on windows gives the following error:

'rm' is not recognized as an internal or external command

Add Karma test runner

It would be nice to add Karma to make debugging easier and give people the flexibility to add adapters, frameworks, coverage reporters etc and use different browsers.

Build failed?

I'm clone (clean) and build via Windows and getting this build failed

failed

Any hint? Thanks.

A typo in README

There is a typo in README.md:

Update name, desription, author, repository in package.json

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.