javascript - error reporting after vue-cli introduces vux
为情所困
为情所困 2017-06-26 10:55:33
0
2
963

build/webpack.base.conf.js code is as follows

var path = require('path')
var utils = require('./utils')
var config = require('../config')
var vueLoaderConfig = require('./vue-loader.conf')
var vuxLoader = require('vux-loader')
function resolve (dir) {
  return path.join(__dirname, '..', dir)
}

const originalConfig = {
  entry: {
    app: './src/main.js'
  },
  output: {
    path: config.build.assetsRoot,
    filename: '[name].js',
    publicPath: process.env.NODE_ENV === 'production'
      ? config.build.assetsPublicPath
      : config.dev.assetsPublicPath
  },
  resolve: {
    extensions: ['.js', '.vue', '.json'],
    alias: {
      'vue$': 'vue/dist/vue.esm.js',

      '@': resolve('src')
    }
  },
  module: {
    rules: [
      {
        test: /\.vue$/,
        loader: 'vue-loader',
        options: vueLoaderConfig
      },
      {
        test: /\.js$/,
        loader: 'babel-loader',
        include: [resolve('src'), resolve('test')]
      },
      {
        test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
        loader: 'url-loader',
        options: {
          limit: 10000,
          name: utils.assetsPath('img/[name].[hash:7].[ext]')
        }
      },
      {
        test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
        loader: 'url-loader',
        options: {
          limit: 10000,
          name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
        }
      }
    ]
  }
}
const webpackConfig = originalConfig // 原来的 module.exports 代码赋值给变量 webpackConfig

module.exports = vuxLoader.merge(webpackConfig, {
  plugins: ['vux-ui']
})

Page that introduces components components/vuxc

<template>
  <p>
    <group>
      <cell title="title" value="value"></cell>
    </group>
  </p>
<**加粗文字**/template>

<script>
  import { Group, Cell } from 'vux'

  export default {
    components: {
      Group,
      Cell
    }
  }
</script>

After webpack.base.config.js is configured, vue-cli can be parsed normally, but when the component is referenced in the page, an error is reported at runtime, as follows

vux loader and vux were installed with cnpm for the first time. After the error was reported, I reinstalled it with npm.
The second command was followed by --save. Why are there still missing dependencies? Urgent!

为情所困
为情所困

reply all(2)
大家讲道理

Do you have css-loader and vue-style-loader in your Package.json

为情所困

css-loader and vue-style-loader are not installed

Run: cnpm install --save-dev css-loader vue-style-loader

Isn’t the hint very obvious? . .

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template