2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-20 20:00:40 +03:00

Revert "Update Webpack + deps, remove now unnecessary polyfills" (#2479)

* Revert "Update Webpack + deps, remove now unnecessary polyfills (#2410)"

This reverts commit 189b34c45a.

* Fix build (#2496)

* Change syntax to see if build passes

* Test commit

* Test with node 10

* Test adding all browsers in travis

* remove other browsers when running on travis
This commit is contained in:
Felipe Martins
2019-10-25 11:34:47 -03:00
committed by GitHub
parent 494d817314
commit 097948698a
13 changed files with 113 additions and 47 deletions
+26 -18
View File
@@ -1,13 +1,12 @@
const webpack = require('webpack');
const TerserPlugin = require('terser-webpack-plugin');
const config = {};
var webpack = require('webpack');
var config = {};
function generateConfig(name) {
return {
mode: 'production',
var uglify = name.indexOf('min') > -1;
var config = {
entry: './index.js',
output: {
path: `${__dirname}/dist`,
path: 'dist/',
filename: name + '.js',
sourceMapFilename: name + '.map',
library: 'axios',
@@ -16,21 +15,30 @@ function generateConfig(name) {
node: {
process: false
},
devtool: 'source-map',
optimization: {
minimize: name.includes('min'),
minimizer: [
// config options documented at https://github.com/webpack-contrib/terser-webpack-plugin#terseroptions
new TerserPlugin({
sourceMap: true,
}),
],
},
devtool: 'source-map'
};
config.plugins = [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
})
];
if (uglify) {
config.plugins.push(
new webpack.optimize.UglifyJsPlugin({
compressor: {
warnings: false
}
})
);
}
return config;
}
['axios', 'axios.min'].forEach(outputScript => {
config[outputScript] = generateConfig(outputScript);
['axios', 'axios.min'].forEach(function (key) {
config[key] = generateConfig(key);
});
module.exports = config;