From 8c29b16edf5b5eb7abc28efcad1bf5c5ab53500a Mon Sep 17 00:00:00 2001 From: Forrest Li Date: Mon, 2 Oct 2023 13:38:57 -0400 Subject: [PATCH] docs(vue): add transpileDependencies note --- Documentation/content/docs/vtk_vue.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Documentation/content/docs/vtk_vue.md b/Documentation/content/docs/vtk_vue.md index 20825cb8011..ef11a5c1b0c 100644 --- a/Documentation/content/docs/vtk_vue.md +++ b/Documentation/content/docs/vtk_vue.md @@ -22,6 +22,24 @@ Now install vtk.js as a dependency. $ npm install @kitware/vtk.js ``` +## Configure your project + +`@kitware/vtk.js` targets ES6+ output, which means if you are intending to target ES5 browsers, you must +tell vue-cli to transpile `@kitware/vtk.js`. Update your `vue.config.js` file to look like the following +snippet below. Visit the [vue-cli documentation](https://cli.vuejs.org/config/#transpiledependencies) for +more info. + +```js +module.exports = defineConfig({ + ... + // If you want to transpile all dependencies: + transpileDependencies: true, + + // If you selectively transpile dependencies: + transpileDependencies: ["@kitware/vtk.js"], +}); +``` + ## Using vtk.js in your app To add a minimal vtk.js example to your app, replace `src/components/HelloWorld.vue` with the following contents.