'How can I have multiple files with custom function declarations?

I would like to split up Excel Custom Function declarations into multiple files for code cleanliness. I changed the webpack entry.functions into an array and added the two separate files:

module.exports = async (env, options) => {
  const dev = options.mode === "development";
  const buildType = dev ? "dev" : "prod";
  const config = {
    devtool: "source-map",
    entry: {
      ...
      functions: ["./src/functions/one.ts", "./src/functions/two.ts"],
      ...

Then (also in webpack config) I added separate CustomFunctionsMetadataPlugin entries in plugins for each of the files:

...
plugins: [
      new CustomFunctionsMetadataPlugin({
        output: "functions.json",
        input: "./src/functions/one.ts",
      }),
      new CustomFunctionsMetadataPlugin({
        output: "functions.json",
        input: "./src/functions/two.ts",
      }),
...

It builds fine but running in Excel only the functions from the last CustomFunctionsMetadataPlugin plugin entry are visible (in this case those custom functions declared in two.ts).

Is there a way to separate excel custom function declarations into multiple files?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source