好玩的.externals&providePlugin

版权声明:个人笔记,不喜勿喷 https://blog.csdn.net/qq_39571197/article/details/88778771

形成一个闭环~

const Webpack = require('webpack');
module.exports = function (config) {
	config.externals = config.externals || {};
	
	Object.assign(config.externals, {
		'axios': 'axios',
		'react': 'React',
		'react-router': 'ReactRouter',
		'redux': 'Redux',
		'react-redux': 'ReactRedux',
	});
	
	config.plugins.push(new Webpack.ProvidePlugin({
		React: 'react',
		ReactRouter: 'react-router',
		redux: 'redux',
		reactRedux: 'react-redux',
	}));
};

 

 

没有更多推荐了,返回首页