vue-cli腳手架之webpack.test.conf.js

webpack單元測試配置: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到底如何測試?如何設置單元測試配置還有待繼續研究。。。web

相關文章
相關標籤/搜索