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.jsvar 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 testsdelete webpackConfig.entrymodule.exports = webpackConfig
惹,文件看上去很简单,实际webpack到底如何测试?如何设置单元测试配置还有待继续研究。。。
vue-cli脚手架之webpack.text.conf.js
原文地址:https://www.cnblogs.com/hongdiandian/p/8319516.html