mirror of
https://github.com/tenrok/axios.git
synced 2026-06-05 16:42:32 +03:00
189b34c45a
* Update deps * handles webpack 1 -> 4 migration * remove promise helpers from dev files assume `Promise` is available, or polyfilled by the consumer * Remove isArray util. `isArray` has good coverage, even in IE9. So lets remove the custom polyfill. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray also resolves a few lint issues * Remove trim util String.protoype.trim has good coverage (including IE9) https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim Also, the http adapter already uses the native method.
37 lines
857 B
JavaScript
37 lines
857 B
JavaScript
const webpack = require('webpack');
|
|
const TerserPlugin = require('terser-webpack-plugin');
|
|
const config = {};
|
|
|
|
function generateConfig(name) {
|
|
return {
|
|
mode: 'production',
|
|
entry: './index.js',
|
|
output: {
|
|
path: `${__dirname}/dist`,
|
|
filename: name + '.js',
|
|
sourceMapFilename: name + '.map',
|
|
library: 'axios',
|
|
libraryTarget: 'umd'
|
|
},
|
|
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,
|
|
}),
|
|
],
|
|
},
|
|
};
|
|
}
|
|
|
|
['axios', 'axios.min'].forEach(outputScript => {
|
|
config[outputScript] = generateConfig(outputScript);
|
|
});
|
|
|
|
module.exports = config;
|