qms
qms

Reputation: 142

set webpack only to compile files

I have old js script that need improvements. I want to write code in es6 style with babeljs compile it to es5 standard with minify in wepback3. How to set webpack to only parse files, save them in another dir and not bundle them?

Upvotes: 0

Views: 37

Answers (1)

Joe Clay
Joe Clay

Reputation: 35797

Webpack is, by definition, a module bundler - while it might be possible to use plugins to hack it into doing a file-by-file copy, I wouldn't advise it.

Instead, use the Babel CLI directly - it will individual files or entire directories depending on what you pass into it. It also has a --minfied option that will minify the output for you, without having to manually pipe the files into UglifyJS.

./node_modules/.bin/babel src --out-dir build --minified

Upvotes: 1

Related Questions