Я пытаюсь сделать некоторые функции, которые обертывают функциональность axios для браузера.Я использую свертку и пытаюсь сделать axios частью пакета, но результат даже не близок к тому, что я ожидаю: axios - 1600 строк, мой пакет - 17 000 и включает в себя вещи, которых вообще не должно быть, например, процесс.stderr.Это моя конфигурация накопительного пакета:
import commonjs from 'rollup-plugin-commonjs';
import nodeResolve from 'rollup-plugin-node-resolve';
import globals from 'rollup-plugin-node-globals';
import babel from "rollup-plugin-babel";
import builtins from 'rollup-plugin-node-builtins';
import json from "rollup-plugin-json";
import pkg from "./package.json";
export default {
input: "src/index.js",
output: [
{
name: "axoi",
file: pkg.main,
format: "iife"
}
],
plugins: [
babel(),
nodeResolve({
jsnext: true,
main: true,
module: true
}),
commonjs({
// non-CommonJS modules will be ignored, but you can also
// specifically include/exclude files
include: 'node_modules/**', // Default: undefined
browser: true,
preferBuiltins: false,
// if true then uses of `global` won't be dealt with by this plugin
ignoreGlobal: false, // Default: false
// if false then skip sourceMap generation for CommonJS modules
sourceMap: false // Default: true
// explicitly specify unresolvable named exports
// (see below for more details)
// namedExports: { './module.js': ['foo', 'bar' ] } // Default: undefined
}),
globals(),
builtins(),
json()
],
experimentalCodeSplitting: true
};