(六)webpack打包图标文件

webpack打包图标文件主要是用到了file-loader,相关配置如下

const path = require('path')
const htmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
    entry: "./src/main.js",
    output:{
        filename: 'index.js',
        path:path.resolve(__dirname, 'build')
    },
    module:{
        rules:[
            {
                test: /\.css$/,
                use:[
                    "style-loader",
                    "css-loader"
                ]
            },
            {
                test: /\.(eot|ttf|svg|woff)$/,
                loader:"file-loader",
                options: {
                    outputPath: 'font/' //指定这些文件打包后的目录
                }
             
            }
        ]
    },
    plugins:[
        new htmlWebpackPlugin({
            template:"./src/index.html"
        })
    ],
    mode:'development'
}

 

posted @ 2020-07-07 22:08  当…风已不再  阅读(261)  评论(0编辑  收藏  举报