-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build hooks package with vite and stop bundling react
- Loading branch information
1 parent
d73e715
commit d2ec026
Showing
5 changed files
with
350 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,6 @@ build | |
.idea | ||
vite.config.ts.timestamp-* | ||
coverage | ||
docs | ||
docs | ||
stats.html | ||
yarn-error.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,39 @@ | ||
import { defineConfig } from "vitest/config" | ||
import react from "@vitejs/plugin-react" | ||
import { resolve } from "path" | ||
import dts from "vite-plugin-dts" | ||
import wasm from "vite-plugin-wasm" | ||
import topLevelAwait from "vite-plugin-top-level-await" | ||
import { visualizer } from "rollup-plugin-visualizer" | ||
|
||
export default defineConfig({ | ||
plugins: [react(), wasm(), topLevelAwait()], | ||
plugins: [ | ||
react(), | ||
wasm(), | ||
topLevelAwait(), | ||
dts({ | ||
insertTypesEntry: true, | ||
}), | ||
process.env.VISUALIZE && visualizer(), | ||
], | ||
build: { | ||
lib: { | ||
entry: resolve(__dirname, 'src/index.ts'), | ||
formats: ['es'], | ||
fileName: 'index', | ||
}, | ||
rollupOptions: { | ||
external: ['react', 'react/jsx-runtime', 'react-dom', 'tailwindcss'], | ||
output: { | ||
globals: { | ||
react: 'React', | ||
'react/jsx-runtime': 'react/jsx-runtime', | ||
'react-dom': 'ReactDOM', | ||
} | ||
} | ||
}, | ||
}, | ||
worker: { | ||
plugins: [wasm(), topLevelAwait()], | ||
}, | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.