簡體   English   中英

如何使用closure-compiler捆綁所有js文件

[英]How to bundle all js files using closure-compiler

我試圖捆綁特定文件夾中的所有.js文件,但收到':沒有這樣的文件或目錄'錯誤。

這是我的代碼:

 const ClosureCompiler = require('google-closure-compiler').jsCompiler; const { writeFile } = require('fs'); const closureCompiler = new ClosureCompiler({ js: 'c:/polyfill/**.js', js_output_file: 'bundle.js' }); const compilerProcess = closureCompiler.run([{ path: './', }], (exitCode, stdOut, stdErr) => { writeFile(stdOut[0].path, stdOut[0].src,()=>{}); }); 

似乎這條路徑js: 'c:/di/webapp/public/js/polyfill/**.js',是錯誤的。如果它是windows,那么通常在c:/你將獲得Users目錄。

您可以轉到文件位置並右鍵單擊該位置以獲取“屬性”。 復制Location值並用向前替換反斜杠

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM