99re热视频这里只精品,久久久天堂国产精品女人,国产av一区二区三区,久久久精品成人免费看片,99久久精品免费看国产一区二区三区

Parcel CLI

2020-02-14 17:26 更新

CLI

Commands

服務(wù)(Serve)

serve 命令啟用一個開發(fā)服務(wù)器,且支持 熱模塊替換 以實現(xiàn)快速開發(fā)。當你更改文件時,該服務(wù)器將自動重新構(gòu)建你的應用程序。

parcel index.html

你也可以為多個入口點傳遞一個glob或 glob 列表。

parcel one.html two.html
# 或
parcel *.html
# 或
parcel ./**/*.html

構(gòu)建(Build)

build 命令會一次性構(gòu)建資源,它還啟用了壓縮功能,并將 NODE_ENV 變量設(shè)置為生產(chǎn)環(huán)境。詳見生產(chǎn)環(huán)境

parcel build index.html

注意: 對于特殊用例,它也可以從開發(fā)環(huán)境執(zhí)行單次構(gòu)建:

NODE_ENV=development parcel build <entrypoint> --no-minify

產(chǎn)生與serve相同的打包,但是沒有監(jiān)聽或資源服務(wù)。

監(jiān)聽(Watch)

監(jiān)聽(watch)命令與服務(wù)器類似,主要區(qū)別在于它并不會啟動服務(wù)器。

parcel watch index.html

幫助(Help)

盡可能的顯示所有 cli 的選項

parcel help

版本(Version)

顯示 Parcel 版本號

parcel --version

Options

設(shè)置輸出目錄

默認為:"dist"

可用于:serve,watch,build

parcel build entry.js --out-dir build/output
# 或者
parcel build entry.js -d build/output
root
- build
- - output
- - - entry.js

設(shè)置要提供服務(wù)的公共 URL

默認為:"/"

可用于:serve,watch,build

parcel entry.js --public-url ./dist/

將輸出到:

<link rel="stylesheet" type="text/css" href="/dist/entry.1a2b3c.css" />
<!-- 或者 -->
<script src="/dist/entry.e5f6g7.js"></script>

目標(Target)

默認為:browser

可用于:serve,watch,build

parcel build entry.js --target node

?? Target 為node and electron的將不會打包dependencies(然而卻包含devDependencies)。使用--bundle-node-modules 標記可以覆蓋這樣的行為(往下看)

可選的目標(target):node, browser, electron

強制 node 模塊打包

默認為:false

可用于: serve, watch, build

parcel build entry.js --target node --bundle-node-modules

默認情況下,當使用 --target node 或 --target electron時,package.json's dependencies將不包含在打包中。這個標記就是為了添加它們進去。

緩存目錄

默認為: ".cache"

可用于: serve, watch, build

parcel build entry.js --cache-dir build/cache

端口

默認為:1234

可用于: serve

parcel serve entry.js --port 1111

更改日志級別

默認為:3

可用于:serve, watch, build

parcel entry.js --log-level 1
日志等級效果
0禁用記錄
1只記錄錯誤
2記錄錯誤和警告
3記錄一切

HMR 主機名

默認為:當前 window 的 location.hostname

可用于:serve,watch

parcel entry.js --hmr-hostname parceljs.org

HMR 端口

默認為:可訪問的隨機端口

可用于:serve, watch

parcel entry.js --hmr-port 8080

輸出的文件名

默認為:源文件名稱

可用于:serve,watch,build

parcel build entry.js --out-file output.html

這改變了入口 bundle 的輸出文件名。

打印詳細的報告

默認為:精簡報告

可選參數(shù)指定要打印報告的深度(depth)

可用于:build

parcel build entry.js --detailed-report
parcel build entry.js --detailed-report 10

啟用 https

默認為:不啟用 https

可用于: serve,watch(熱更新 hmr 采用 https 連接)

parcel entry.js --https

?? 這個配置會生成一個自簽名證書,你可能需要配置你的瀏覽器,使之接受 localhost 上的自簽名證書。

設(shè)置一個自定義證書

默認為:不啟用 https

可用于:serve,watch

parcel entry.js --cert certificate.cert --key private.key

在瀏覽器中打開

默認為:禁用

可用于:serve

parcel entry.js --open

禁用源代碼映射(source-maps)

默認為:啟用

可用于:serve,watch,build

parcel build entry.js --no-source-maps

禁用文件 hash 命名(content-hash)

默認為:啟用

可用于:build

parcel build entry.js --no-content-hash

禁用自動安裝依賴(autoinstall)

默認為:啟用

可用于:serve,watch

parcel entry.js --no-autoinstall

禁用熱替換(HMR)

默認為:啟用

可用于:serve,watch

parcel entry.js --no-hmr

禁用代碼壓縮(minification)

默認為:啟用

可用于:build

parcel build entry.js --no-minify

禁用文件系統(tǒng)緩存

默認為:緩存啟用

可用于:serve, watch, build

parcel build entry.js --no-cache

UMD 方式暴露模塊

默認為:禁止

可用于:serve, watch, build

parcel serve entry.js --global myvariable

開啟實驗性的 scope hoisting/tree shaking 支持

默認為:禁止

可用于:build

parcel build entry.js --experimental-scope-hoisting

更多信息,請查看 Devon Govett's post on Parcel 1.9 Tree Shaking section


以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號