简体   繁体   English

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

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

I am trying to bundle all .js files in a specific folder, but receive a ': no such file or directory' error. 我试图捆绑特定文件夹中的所有.js文件,但收到':没有这样的文件或目录'错误。

Here is my code: 这是我的代码:

 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,()=>{}); }); 

It seem this path js: 'c:/di/webapp/public/js/polyfill/**.js', is wrong.If it is windows then normally after c:/ you will get the Users directory. 似乎这条路径js: 'c:/di/webapp/public/js/polyfill/**.js',是错误的。如果它是windows,那么通常在c:/你将获得Users目录。

You can go to the file location and right click on that to get the 'Properties' . 您可以转到文件位置并右键单击该位置以获取“属性”。 Copy Location value and replace the backward slash with forward 复制Location值并用向前替换反斜杠

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM