使用CopyWebpackPlugin插件,在webpack中copy文件或文件夹

1、下载插件CopyWebpackPlugin

$ npm install copy-webpack-plugin --save-dev

2、在build/webpack.base.conf.js文件下使用插件:

const CopyWebpackPlugin = require('copy-webpack-plugin');

plugins: [
    new CopyWebpackPlugin([
        {
            from: path.join(__dirname, "../***.txt"),
            to: path.join(__dirname, "../dist/***.txt")
        } 
    ])
]

from 要拷贝的文件路径

to 输出路径

Logo

前往低代码交流专区

更多推荐