vue-cli脚手架之webpack.text.conf.js

Posted 静静是小花

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vue-cli脚手架之webpack.text.conf.js相关的知识,希望对你有一定的参考价值。

webpack单元测试配置:

// This is the webpack config used for unit tests.

var utils = require(‘./utils‘)//utils.js文件导入
var webpack = require(‘webpack‘)//webpack模块导入
var merge = require(‘webpack-merge‘)//合并模块插件
var baseConfig = require(‘./webpack.base.conf‘)//导入基础配置webpack.base.conf.js

var webpackConfig = merge(baseConfig, {
  // use inline sourcemap for karma-sourcemap-loader
  module: {
    rules: utils.styleLoaders()
  },
  devtool: ‘#inline-source-map‘,
  plugins: [
    new webpack.DefinePlugin({
      ‘process.env‘: require(‘../config/test.env‘)//指定环境为测试环境  test.env中设置了NODE_ENV=‘testing’
    })
  ]
})

// no need for app entry during tests
delete webpackConfig.entry

module.exports = webpackConfig

 

惹,文件看上去很简单,实际webpack到底如何测试?如何设置单元测试配置还有待继续研究。。。

以上是关于vue-cli脚手架之webpack.text.conf.js的主要内容,如果未能解决你的问题,请参考以下文章

vue-cli脚手架之其他文件解释

vue-cli脚手架之webpack.text.conf.js

vue-cli脚手架之webpack.prod.conf.js

VUE学习笔记:27.脚手架vue-cli之promise

手把手教学之vue-cli快速搭建脚手架

VUE学习笔记:29.脚手架vue-cli之axios