ethers.js/rollup.config.js

48 lines
1.1 KiB
JavaScript
Raw Normal View History

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,
format: "esm",
sourcemap: true
},
2022-12-04 00:59:49 +03:00
context: "window",
2022-09-05 23:14:43 +03:00
treeshake: false,
plugins: [ nodeResolve({
exportConditions,
mainFields,
modulesOnly: true,
preferBuiltins: false
}) ],
};
}
export default [
getConfig({ browser: true }),
{
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
}) ],
}
];