• vux环境配置


    1.安装VUX依赖

    npm install vux --save

    2.安装vux-loader

    npm install vux-loader --save-dev

    3.安装less-loader

    npm install less less-loader --save-dev

    4.

    在bulid —>webpack.base.conf.js下,

    1)首先引入vux-loader

    const vuxLoader = require('vux-loader')

    5.然后将原来的module.exports 替换成const webpackConfig,然后在最底下写上这么一段代码

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

    如:

    'use strict'
    const path = require('path')
    const utils = require('./utils')
    const config = require('../config')
    const vueLoaderConfig = require('./vue-loader.conf')
    const vuxLoader = require('vux-loader')
    
    function resolve (dir) {
      return path.join(__dirname, '..', dir)
    }
    
    const webpackConfig = {
      context: path.resolve(__dirname, '../'),
      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'), resolve('node_modules/webpack-dev-server/client')]
          },
          {
            test: /.(png|jpe?g|gif|svg)(?.*)?$/,
            loader: 'url-loader',
            options: {
              limit: 10000,
              name: utils.assetsPath('img/[name].[hash:7].[ext]')
            }
          },
          {
            test: /.(mp4|webm|ogg|mp3|wav|flac|aac)(?.*)?$/,
            loader: 'url-loader',
            options: {
              limit: 10000,
              name: utils.assetsPath('media/[name].[hash:7].[ext]')
            }
          },
          {
            test: /.(woff2?|eot|ttf|otf)(?.*)?$/,
            loader: 'url-loader',
            options: {
              limit: 10000,
              name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
            }
          }
        ]
      },
      node: {
        // prevent webpack from injecting useless setImmediate polyfill because Vue
        // source contains it (although only uses it if it's native).
        setImmediate: false,
        // prevent webpack from injecting mocks to Node native modules
        // that does not make sense for the client
        dgram: 'empty',
        fs: 'empty',
        net: 'empty',
        tls: 'empty',
        child_process: 'empty'
      }
    }
    
    module.exports = vuxLoader.merge(webpackConfig, {
      plugins: ['vux-ui']
    })
  • 相关阅读:
    linux---集群架构初探(14)静态、动态、流量术语
    linux---集群架构初探(13)http与www服务基础介绍
    linux---集群架构初探(12)ansible剧本模式(playbook)
    linux---集群架构初探(11) 实践:一键部署nfs
    linux---集群架构初探(10)Ansible常用模块
    试题一 讲解
    aws 试题
    linux 常用命令。
    nohub命令简单介绍。
    Linux 系统conda环境,pip文件的导出和安装。
  • 原文地址:https://www.cnblogs.com/chenziyu/p/9844898.html
Copyright © 2020-2023  润新知