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


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' ] } ] }
}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM