问答详情
源自:4-1 webpack配置css单独分离打包

打包报错Unexpected character '#' (1:0)You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file.

http://img.mukewang.com/5e53eaa30001b75105920766.jpg  啥情况!!!

提问者:Gronbu1 2020-02-24 23:24

个回答

  • 孜孜胖胖
    2020-03-10 13:39:31

    app.vue报错

    原因:

    css的id符号无法识别。需要css-loader进行解析

    const path = require('path')

    const VueLoaderPlugin = require('vue-loader/lib/plugin')


    module.exports = {

      entry: path.join(__dirname,'src/index.js'),

      output: {

        filename: 'bundle.js',

        path: path.join(__dirname,'dist')

      },

      plugins:[

        new VueLoaderPlugin()

      ],

      module: {

        rules: [

          {

            test: /\.vue$/,

            loader: 'vue-loader'

          },

          {

            test: /\.css$/,

            loader: ['style-loader','css-loader']

          }//加了css-loader

        ]

      }

    }


  • 孜孜胖胖
    2020-03-10 13:38:27

      .styl 文件没有loader,按视频的安装一下。如果不行注意一下三个loader的顺序。原因:因为.styl需要依次经过stylus-loader, postcss-loader css-loader, style-loader编译。因此需要按此顺序配置

    {

      test:/\.styl/,

        use:[

          'style-loader',

          'css-loader',

          {

            loader: 'postcss-loader',

            options: {

              sourceMap: true

            }

          },

          'stylus-loader'

        ]

    },


  • 慕婉清1346653
    2020-02-25 13:22:07

    他不是告诉你了吗,你有个loader没有装