简体   繁体   中英

Npm scripts command not behaving like on shell

I'm trying to concatenate an arbitrary number of Javascript files into one big one.

I have the following command declared in the scripts part of my package.json

"js:dev": "uglifyjs inz/js/**/*.js > 'ouz/haz/js/main.js'"

When I run npm run js:dev the file gets written, but always with empty content. If however I run the following directly on my shell (which is zsh) the expected contents get written into the file:

node_modules/uglifyjs/bin/uglifyjs inz/js/**/*.js > 'ouz/haz/js/main.js'

Why is this? I would expect both ways to behave the same. Is file globbing working differently in the context of npm run ?

I bet ** isn't supported there.

find inz/js -type f -name '*.js' -exec uglifyjs {} + >ouz/haz/js/main.js – 4ae1e1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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