creat-react-app一直讓我很舒服,無論是結合TS仍是開發組件,忽然有一天css
npm run build
Creating an optimized production build...(預計10分鐘經過)
複製代碼
而後你們提倡升級webpack,而後就開啓瞭如履薄冰的升級之路,每天跟便祕同樣html
直到我看到了網紅打包工具Parcel(確實孤陋寡聞了),小試一下,而後就又舒服了,而後本身嘗試結合 React 和 TS 弄了個腳手架,node
npm install parcel-bundler
parcel index.html
複製代碼
就是這麼直接而且粗暴,localhost:1234就起來了,可是爲了腳手架,仍是把parcel-bundle放到具體的項目裏邊react
npm install --save-dev parcel-bundler
npx parcel index.html
複製代碼
參考: parceljs.org/getting_sta…webpack
npm install --save react
npm install --save react-dom
npm install --save-dev babel-preset-react
複製代碼
而後去package.json裏邊配置命令git
"scripts": {
"start": "npx parcel index.html"
}
複製代碼
依舊簡單粗暴github
參考: parceljs.org/recipes.htm…web
結合TS稍微麻煩一點,可是這跟parcel不要緊,是TS本身事兒多typescript
npm install --save-dev typescript
npm install --save-dev @types/react
npm install --save-dev @types/react-dom
複製代碼
而後按照慣例構建tsconfig.json文件就能夠了,簡單粗暴npm
順便加了tslint和sass+postCSS
"dependencies": {
"react": "^16.2.0",
"react-dom": "^16.2.0",
},
"devDependencies": {
"sass": "^1.15.2",
"autoprefixer": "^9.4.3",
"postcss-modules": "^1.4.1",
"@types/react-dom": "^16.0.3",
"@types/node": "^10.12.18",
"@types/react": "^16.7.18",
"babel-preset-react": "^6.24.1",
"parcel-bundler": "^1.0.3",
"tslint": "^5.12.0",
"tslint-config-airbnb": "^5.11.1",
"typescript": "^3.2.2"
}
複製代碼
本身弄了一個簡陋的腳手架
github: github.com/ZJBC/react-… npm: www.npmjs.com/package/rea…
支持 組件開發 和 應用開發 兩種模式,🦀️🦀️