mirror of
https://github.com/axios/axios.git
synced 2026-04-12 14:41:55 +08:00
This should solve the issue of undefined `this` when importing from an ES6 module. I've put steps to reproduce in [this comment](https://github.com/axios/axios/issues/1861#issuecomment-669832435). Co-authored-by: Jay <jasonsaayman@gmail.com>
31 lines
685 B
JavaScript
31 lines
685 B
JavaScript
const TerserPlugin = require('terser-webpack-plugin');
|
|
var webpack = require('webpack');
|
|
var config = {};
|
|
|
|
function generateConfig(name) {
|
|
var compress = name.indexOf('min') > -1;
|
|
var config = {
|
|
entry: './index.js',
|
|
output: {
|
|
path: __dirname + '/dist/',
|
|
filename: name + '.js',
|
|
sourceMapFilename: name + '.map',
|
|
library: 'axios',
|
|
libraryTarget: 'umd',
|
|
globalObject: 'this'
|
|
},
|
|
node: {
|
|
process: false
|
|
},
|
|
devtool: 'source-map',
|
|
mode: compress ? 'production' : 'development'
|
|
};
|
|
return config;
|
|
}
|
|
|
|
['axios', 'axios.min'].forEach(function (key) {
|
|
config[key] = generateConfig(key);
|
|
});
|
|
|
|
module.exports = config;
|