You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders

时间:2020-05-24 12:45:01   收藏:0   阅读:515

You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders

解决:

var path=require(path)
/**
 * @author xilh
 * @since 20200524
 * @see https://webpack.js.org/concepts/loaders/
 *      https://webpack.js.org/concepts#loaders
 * 
 * webpack 打包 css 文件
 * 1. 需要安装 style-loader css-loader
 * npm install style-loader css-loader --save-dev
 * npm install file-loader --save-dev
 * 2. 依赖 css 需要这么写:require("style-loader!css-loader!./css/css1.css");
 */
module.exports={
    entry: ./src/main.js,
    mode: development,
    output: {
        path: path.resolve(__dirname, ./dist),
        filename: bundle.js
    },
    module: {
        rules: [
            {
                
                test: ‘/\.css$/‘,
                use: [
                    ‘style-loader‘,
                    ‘css-loader‘
                ]

            }
        ]
    }
}

 

原文:https://www.cnblogs.com/xiluhua/p/12950429.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!