@webspatial/vite-plugin
v0.2.1
Published
`pnpm i -D @webspatial/vite-plugin`
Keywords
Readme
install
pnpm i -D @webspatial/vite-plugin
add /// <reference types="@webspatial/vite-plugin" /> to vite-env.d.ts
for typescript project.
make sure add these:
// tsconfig.json
{
"jsx": "react-jsx",
"jsxImportSource": "@webspatial/react-sdk",
}
// vite.config.ts
import WebSpatial from '@webspatial/vite-plugin'
export default defineConfig({
plugins: [
react(),
WebSpatial(), // <----- use it
],
})for javascript project.
make sure add these:
// vite.config.ts
import WebSpatial from '@webspatial/vite-plugin'
export default defineConfig({
plugins: [
react({ jsxImportSource: '@webspatial/react-sdk' }),
WebSpatial(), // <----- use it
],
})in package.json, make sure concurrently is installed
"scripts":{
"dev:all":"concurrently \"vite\" \"XR_ENV=avp vite \" ",
"build:all": "vite build && XR_ENV=avp vite build"
}if you are using react-router, please set basename like this
const basename = process.env.XR_ENV === 'avp' ? '/webspatial/avp' : '/'
function App() {
return <Router basename={basename}>// other logic</Router>
}dev
run npm run dev:all will startup the devServer
build
run npm run build:all will build the output
