Configuration(Recipes)
Configuration (Recipes)
React
First you need to install the dependencies of React.
Blog Post
npm install --save react npm install --save react-dom npm install --save-dev parcel-bundler npm install --save-dev babel-preset-env npm install --save-dev babel-preset-react
Or if you have installed the optional Yarn package manager
yarn add react yarn add react-dom yarn add --dev parcel-bundler yarn add --dev babel-preset-env yarn add --dev babel-preset-react
Then make sure the following Babel configuration is present.
// .babelrc { "presets": ["env", "react"] } 添加 start 脚本到 package.json // package.json "scripts": { "start": "parcel index.html" }
Preact
#First, we need to install Preact’s dependencies.
npm install --save preact npm install --save preact-compat npm install --save-dev parcel-bundler npm install --save-dev babel-preset-env npm install --save-dev babel-preset-preact
Or if you have installed the optional Yarn package manager
yarn add preact yarn add preact-compat yarn add --dev parcel-bundler yarn add --dev babel-preset-env yarn add --dev babel-preset-preact
Then make sure the following Babel configuration exists.
// .babelrc { "presets": ["env", "preact"] }
Add start script to package.json
// package.json "scripts": { "start": "parcel index.html" }