老师能看一下为什么还会报错

来源:2-1 vue-loader+webpack项目配置

八哥love

2018-08-02 17:35

ERROR in ./page/app.vue

Module build failed (from ./node_modules/css-loader/index.js):

Unknown word (2:19)


  1 | <template>

> 2 |   <div id="test">{{text}}</div>

    |                    ^

  3 | </template>

  4 | <script>

  5 |   export default {


 @ ./page/index.js 2:0-27 8:18-21

npm ERR! code ELIFECYCLE

npm ERR! errno 2

npm ERR! wpc@1.0.0 build: `webpack --config webpack.config.js`

npm ERR! Exit status 2

npm ERR!

npm ERR! Failed at the wpc@1.0.0 build script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.


npm ERR! A complete log of this run can be found in:

npm ERR!     C:\Users\Zuoqi Li\AppData\Roaming\npm-cache\_logs\2018-08-02T08_55_40_024Z-debug.log


C:\project\works_pro\wpc>npm i style-loader url-loader file-loader

npm WARN wpc@1.0.0 No description

npm WARN wpc@1.0.0 No repository field.

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):

npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

https://img3.mukewang.com/5b62d0610001badd12460576.jpg

写回答 关注

2回答

  • fallen_down
    2018-09-14 11:28:29

    我找到了答案,分享给大家。

    只要修改webpack.config.js就可以打包了。

    const path = require('path');   

    const {VueLoaderPlugin}=require('vue-loader');  


        module.exports = {

            entry: path.resolve(__dirname, "src/index.js"),   //webpack4官方绝对路径

        devServer: {

            contentBase: './dist'

        },

        output: {

        filename: 'bundle.js',

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

        },

        module: {

        rules: [

            {

    test: /\.vue$/,

    use: [

    'vue-loader'        

    ]

    },

    {

    test: /\.css$/,

    use: [

    'vue-style-loader',                //可以不要

    'style-loader',                        

    'css-loader'

    ]

    },

    ]

    },

    plugins:[

    new VueLoaderPlugin()

    ]

    };


  • qq_影子颌_0
    2018-08-03 18:35:04

    Failed at the wpc@1.0.0 build script. 这个错误貌似是新版本的得在webpack.config.js加上

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

    然后在 plugins 里面加 new VueLoaderPlugin()

    不知道你的是不是因为这个,我的已经能跑了,都用的自动下载的版本。(今天刚开始学vue)

    ahswch 回复ahswch

    谢谢你 这个错误我弄好了 找到这个https://blog.csdn.net/cominglately/article/details/80555210 弄好的

    2018-08-11 23:31:17

    共 2 条回复 >

Vue+Webpack打造todo应用

用前端最热门框架Vue+最火打包工具Webpack打造todo应用

84606 学习 · 787 问题

查看课程

相似问题