2022-09-05 23:14:43 +03:00
|
|
|
|
|
|
|
import { nodeResolve } from '@rollup/plugin-node-resolve';
|
|
|
|
|
|
|
|
function getConfig(opts) {
|
|
|
|
if (opts == null) { opts = { }; }
|
|
|
|
|
|
|
|
const file = `./dist/ethers${ (opts.suffix || "") }.js`;
|
|
|
|
const exportConditions = [ "default", "module", "import" ];
|
|
|
|
const mainFields = [ "module", "main" ];
|
|
|
|
if (opts.browser) { mainFields.unshift("browser"); }
|
|
|
|
|
|
|
|
return {
|
|
|
|
input: "./lib.esm/index.js",
|
|
|
|
output: {
|
|
|
|
file,
|
2023-03-07 10:07:03 +03:00
|
|
|
banner: "const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !== 'undefined' ? window: typeof global !== 'undefined' ? global: typeof self !== 'undefined' ? self: {});",
|
2023-02-23 05:03:47 +03:00
|
|
|
name: (opts.name || undefined),
|
|
|
|
format: (opts.format || "esm"),
|
2022-09-05 23:14:43 +03:00
|
|
|
sourcemap: true
|
|
|
|
},
|
2023-03-07 10:07:03 +03:00
|
|
|
context: "__$G",
|
2023-04-24 13:36:07 +03:00
|
|
|
treeshake: true,
|
2022-09-05 23:14:43 +03:00
|
|
|
plugins: [ nodeResolve({
|
|
|
|
exportConditions,
|
|
|
|
mainFields,
|
|
|
|
modulesOnly: true,
|
|
|
|
preferBuiltins: false
|
|
|
|
}) ],
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export default [
|
|
|
|
getConfig({ browser: true }),
|
2023-02-23 05:03:47 +03:00
|
|
|
getConfig({ browser: true, suffix: ".umd", format: "umd", name: "ethers" }),
|
2022-09-05 23:14:43 +03:00
|
|
|
{
|
|
|
|
input: "./lib.esm/wordlists/wordlists-extra.js",
|
|
|
|
output: {
|
|
|
|
file: "./dist/wordlists-extra.js",
|
|
|
|
format: "esm",
|
|
|
|
sourcemap: true
|
|
|
|
},
|
|
|
|
treeshake: true,
|
|
|
|
plugins: [ nodeResolve({
|
|
|
|
exportConditions: [ "default", "module", "import" ],
|
|
|
|
mainFields: [ "browser", "module", "main" ],
|
|
|
|
modulesOnly: true,
|
|
|
|
preferBuiltins: false
|
|
|
|
}) ],
|
|
|
|
}
|
|
|
|
];
|