问答详情
源自:2-1 vue-loader+webpack项目配置

为什么我输入了这段代码,还是报错You may need an appropriate loader to handle this file type

module: {

rules: [

{

test: /.vue$/,

loader: "vue-loader"

}

]

}


提问者:小丑瓜 2018-12-03 14:12

个回答

  • 念念了
    2018-12-05 19:18:53

    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')},
    module: {
    rules: [
    {
        test: /\.vue$/,loader: 'vue-loader'
    }, 
    {
    test: /\.css$/,
    use: [
        "vue-style-loader", 
        "css-loader"
    ]}]
        },
        plugins: [new VueLoaderPlugin()]
    }

    还要加上包

    "vue-style-loader": "^4.1.2"


  • 天使别堕落
    2018-12-05 13:54:59

    大佬,加上这段,{

    test: /\.css$/,

    use: [

    'vue-style-loader',

    'css-loader'

    ]

    }