yumeishih / react-shopping-cart

Implement a simple shopping cart website with pure react
2 stars 0 forks source link

react-shopping-cart

Implement a simple shopping cart website

Environment Require


  1. npm (version 5.6.0 or above)
  2. node (version 7.0.0 or above)

Get Start


Initialize(install the packages in package.json):

$ npm install

Run server:

$ node run dev

Browser: http://localhost:8080/

Testing

$ npm run test

packages


packages for loader
packages for testing
Some weird learning note

Q: Mocha can't read webpack's config, however, while testing wanted to use webpack resolve.alias to import the module

A: In .babeltc add the plugin babel-plugin-webpack-aliases

    "plugins": [
        [ "babel-plugin-webpack-aliases", { "config": "./webpack.config.js" } ]
    ]
$ npm run test --> $ mocha --watch --compilers js:babel-core/register --require ./test/helpers.js --require ./test/dom.js --recursive

while runing babel-core/register, webpack.config.js will be include.