問題:想將打包生成的 dist 文件下的樣式相關文件,進行移動。
解決:在 npm 上找寫好的兼容操作系統的包
?move-file-cli?
插件?,用于移動文件
move-file-cli 插件的安裝與使用
安裝:npm install move-file-cli --save-dev
在包文件下,寫運行命令:move-file 起始文件地址 移動到的終點地址?
例子:采用?move-file-cli插件,
移動樣式文件的目錄:將 es 文件夾
移動到 dist的根目錄
① 在包文件的 scripts 下中,寫 "move-style":"move-file dist/es/index.css dist/index.css"
;
② 【先進行打包完成后(修改?build-only?
用于運行打包?run-p build-es build-umd
)再運行樣式移動(npm run move-style
),以防還沒有生成文件index.css 】【本例的其他注意點】
?③ 刪除dist,重新運行打包 npm run build
????查看 dist 文件,當前 index.css 已被移動到了 dist 文件下。?