Hi @mpaler,
This is easily possible using both rollup and webpack.
Rollup
With rollup you should change your config to export an array of objects, each corresponding to an autotask. Something like this:
const options = {
plugins: [resolve({ preferBuiltins: true }), commonjs(), json({ compact: true }), typescript()],
external: [...builtins, 'ethers', 'web3', 'axios', /^defender-relay-client(\/.*)?$/],
};
export default [
{
input: 'src/autotaskA.ts',
output: {
file: 'dist/autotaskA.js',
format: 'cjs',
},
...options,
},
{
input: 'src/autotaskB.ts',
output: {
file: 'dist/autotaskB.js',
format: 'cjs',
},
...options,
},
];
Webpack
Its a bit more straightforward to do with webpack and doesnt duplicate as much code. In webpack.config.js
change entry
to an object, adding an entry for each autotask script:
entry: {
autotaskA: './src/autotaskA.ts',
autotaskB: './src/autotaskB.ts',
}
Then you will need to change filename
in output
to this:
output: {
filename: '[name].js',
...
},
Build as normal and you should see 2 separate files for each autotask.