2
我試圖用npm來縮小javascript。npm運行腳本導致Windows腳本宿主錯誤
這是我的package.json:
{
"name": "name1",
"version": "1.0.0",
"description": "",
"scripts": {
"minifyjs": "minifyJs",
"minifycss": "minifyCss",
"minifyhtml": "minifyHtml"
},
"author": "",
"license": "ISC",
"devDependencies": {
"clean-css": "^3.4.19",
"html-minifier": "^3.0.2",
"uglify-js": "^2.7.0"
}
}
和我minifyJs腳本是:
var uglifyJS = require('uglify-js');
var fs = require('fs');
var result = uglifyJS.minify(['src/main1.js', 'src/main2.js'], {
compress: {
drop_console: true,
unused: true
}
});
fs.writeFileSync('dist/minifyJs.js', result.code);
當我打電話NPM運行minifyjs我得到以下錯誤:
我在做什麼錯 - 順便說一句,這是在另一臺機器上工作.. ...
任何人都可以幫忙嗎?
該訣竅。非常感謝!!我一定花了2個小時來做這個重新設計,不過......非常感謝 – Ilyas