Deployment

The lib directory of the VSDX Export contains an npm module with several dependencies. Therefore, we recommend that you manage the dependencies of your project with npm or a compatible tool and use a bundler like vite to deploy your application.

Have a look at the yFiles for HTML deployment guide on how to deploy a yFiles application.

When using the yFiles for HTML Optimizer together with the VSDX Export, make sure to include the following options:

module.exports = {
  mode: "production",
  plugins: [
    new OptimizerPlugin({
      blacklist: [
        "connections",
        "convert",
        "edge",
        "serialize",
        "deserialize",
        "template",
        "visible",
        "Node"
      ],
      shouldOptimize(module) {
        return (
          /[\\/]@yfiles[/\\]vsdx-export[\\/]/.test(module.resource) ||
          !/node_modules/.test(module.resource)
        );
      }
    })
  ],
  // ...
}

The items on the blacklist ensure that the VSDX Export works after obfuscation. We also override the shouldOptimize option to make sure the VSDX Export is included in the obfuscation process (it is excluded by default because it resides in the node_modules directory). Otherwise, it wouldn’t work with an obfuscated yFiles for HTML library.