Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexniver/87130db5216a7f8221d61e3f03efdc42 to your computer and use it in GitHub Desktop.
Save alexniver/87130db5216a7f8221d61e3f03efdc42 to your computer and use it in GitHub Desktop.
create an front-end project with react redux immutable, link from https://www.sitepoint.com/how-to-build-a-todo-app-using-react-redux-and-immutable-js/
mkdir test1 # dir path must not contine 'react', will cause error
npm init

set info

npm install --save react react-dom redux react-redux immutable
npm install --save-dev webpack babel-loader babel-preset-es2015 babel-preset-react

set webpack, create webpack.config.js

module.exports = {
  entry: './src/app.js',
  output: {
    path: __dirname,
    filename: 'bundle.js'
  },
  module: {
    loaders: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        loader: 'babel',
        query: { presets: [ 'es2015', 'react' ] }
      }
    ]
  }
};

extend our package.json by adding an npm script to compile our code with source maps

"script": {
  "build": "webpack --debug"
  "watch": "webpack --watch"
}

We’ll need to run npm run build each time we want to compile our code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment