Vite
|
Note
|
Relevant Demos: Vite, Vue, React, React Class Components, Svelte, Vue Component Node Style, React Component Node Style |
yFiles works out of the box with Vite, and there are no special issues that you need to look out for when you load yFiles as an NPM dependency.
Visit @yworks/optimizer for detailed documentation and the latest configuration instructions for integrating @yworks/optimizer into this toolchain.
Webpack
|
Note
|
Relevant Demos: webpack, Web Worker Webpack |
Separate yFiles Chunk
Code Splitting allows you to split your code into multiple chunks. It is usually a good idea to have the yFiles library files in a separate chunk as they rarely change and thus can be cached for a longer time.
To create a separate yFiles chunk, add an entry to the optimization.splitChunks.cacheGroups option in your webpack configuration:
optimization: {
splitChunks: {
cacheGroups: {
yfiles: {
test: /[\\/]yfiles[\\/]/,
name: 'yfiles',
chunks: 'all',
priority: 10
},
vendors: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
chunks: 'all'
}
}
}
}Integrating the yWorks Optimizer
Visit @yworks/optimizer for detailed documentation and the latest configuration instructions for integrating @yworks/optimizer into this toolchain.
Excluding the yFiles Chunk from Minimization
Minimizing the yFiles library files is not necessary because they are already minimized. Furthermore, the minimization process can be time-consuming. Although webpack caches some results, reducing build times for subsequent runs, excluding the yFiles chunk from the minimization step, e.g., CI builds which start the build from a clean state).
To exclude the yFiles chunk from minimization, provide the minimizer option in the webpack configuration (this assumes that the yFiles chunk is named "yfiles" like in the Separate yFiles Chunk section):
const TerserPlugin = require('terser-webpack-plugin');
module.exports = {
// ... your webpack configuration
minimizer: [
new TerserPlugin({
exclude: /^yfiles\./
})
]
}Angular
|
Note
|
Relevant Demos: Angular, Angular Component Node Style Tutorial: yFiles for HTML + Angular (GitHub) |
When you load yFiles as an NPM dependency, no special considerations are necessary.
Vue.js
|
Note
|
Relevant Demos: Vue, Vue Component Node Style, Vue Template Node Style Tutorial: yFiles for HTML + Vue (GitHub) |
When you load yFiles as an NPM dependency, there are no special considerations to keep in mind.
Visit @yworks/optimizer for detailed documentation and the latest configuration instructions for integrating @yworks/optimizer into this toolchain.
React
|
Note
|
Relevant Demos: React, React Class Components, React Component Node Style, React JSX Component Style Tutorial: yFiles for HTML + React (GitHub) |
When you load yFiles as an NPM dependency, no special considerations are necessary.
Visit @yworks/optimizer for detailed documentation and the latest configuration instructions for integrating @yworks/optimizer into this toolchain.