简体   繁体   中英

Webpack: Copy javascript files to output directory without processing them

I have a typescript project setup with webpack. This project also contains some javascript files that should be copied to the output directory without processing them in any way.

How can I achieve this?

I guess you can identify those file. May with some glob patter or by direct file name. Then use

copy-webpack-plugin

I wouldn't try to do that with WebPack... Just copy the files with an npm script. lets say somenthing like this in your package.json

"scripts": {
   "deldist": "rimraf ./assets/dist",
   "copy": "copy command here",
   "prod": "npm run deldist && cross-env NODE_ENV=production webpack --progress --hide-modules --display-error-details && npm run copy"
 },

... then you could run

npm run prod

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