//下載全局依賴
npm install -g parcel-bundler
parcel主要命令
parcel -h # 查看幫助信息 parcel serve -h # 本地開發模式,會啟動一個默認1234端口的本地服務器,代理到配置的目標文件,前端頁面開發為主 parcel watch -h # 監聽文件改動模式,不會啟動默認本地服務器,服務端開發為主 parcel build -h # 編譯源文件並打包到目標�文件夾
build 命令
-d, --out-dir <path> # 打包目標文件夾 默認 "dist" -o, --out-file <filename> # 項目入口文件的文件名,默認與 --public-url 一致 --no-minify # 打包時不壓縮源文件 --detailed-report # 打印詳細打包資源報告
開發與打包 注意這里使用 * 號匹配html路徑
# 開發 parcel serve pathto/pages/*.html --no-cache # 打包(多頁面打包命令關鍵) parcel build pathto/pages/*.html --public-url ./ --no-source-maps --no-cache --detailed-report
parcel原理簡介