Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions rhino3dm/js/SampleVite/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,18 @@ To run: `npm run dev`
Note: There are three things I needed to do to make this work:

1. Import rhino3dm: `npm i rhino3dm`
2. Change the 'main' entry file to rhino3dm to use the module. This change is in `node_modules/rhino3dm/package.json`: "main": "rhino3dm.module.js"
3. Create a vite.config.js file in the root of the project with the following contents:
2. Create a vite.config.js file in the root of the project with the following contents:

```js
import {defineConfig} from 'vite'
export default defineConfig({
optimizeDeps: {
exclude: ['rhino3dm'],
},
});
resolve: {
alias: {
'rhino3dm': path.resolve(__dirname, 'node_modules/rhino3dm/rhino3dm.module.js')
}
}
})
```
8 changes: 7 additions & 1 deletion rhino3dm/js/SampleVite/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,10 @@ export default defineConfig({
optimizeDeps: {
exclude: ['rhino3dm'],
},
});
// use the rhino3dm.module.js entrypoint
resolve: {
alias: {
'rhino3dm': path.resolve(__dirname, 'node_modules/rhino3dm/rhino3dm.module.js')
}
}
})