-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #282 from suiet/feat/refactor-bundling
Feat/refactor bundling
- Loading branch information
Showing
7 changed files
with
1,537 additions
and
313 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
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,45 +1,72 @@ | ||
import { defineConfig } from 'vite'; | ||
import react from '@vitejs/plugin-react'; | ||
import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin'; | ||
import viteSvgr from 'vite-plugin-svgr'; | ||
import path from 'path'; | ||
import { defineConfig } from "vite"; | ||
import react from "@vitejs/plugin-react"; | ||
import { vanillaExtractPlugin } from "@vanilla-extract/vite-plugin"; | ||
import viteSvgr from "vite-plugin-svgr"; | ||
import path from "path"; | ||
import { visualizer } from "rollup-plugin-visualizer"; | ||
|
||
// https://vitejs.dev/config/ | ||
export default defineConfig(({mode}) => ({ | ||
plugins: [react(), vanillaExtractPlugin(), viteSvgr()], | ||
css: { | ||
modules: { | ||
localsConvention: 'camelCase', | ||
}, | ||
}, | ||
esbuild: { | ||
target: "es2020", | ||
pure: mode === 'production' ? ['console.log', 'debugger'] : [], | ||
}, | ||
optimizeDeps: { | ||
esbuildOptions : { | ||
target: "es2020" | ||
} | ||
}, | ||
export default defineConfig(({ mode }) => ({ | ||
build: { | ||
target: 'es2020', | ||
target: "es2020", | ||
lib: { | ||
entry: path.resolve(__dirname, './src/index.ts'), | ||
fileName: 'index', | ||
name: 'suietWalletKit' | ||
entry: path.resolve(__dirname, "./src/index.ts"), | ||
fileName: "index", | ||
name: "suietWalletKit", | ||
}, | ||
emptyOutDir: false, | ||
sourcemap: false, | ||
minify: true, | ||
rollupOptions: { | ||
external: ['react', 'react-dom', '@mysten/sui.js'], | ||
external: [ | ||
"react", | ||
"react-dom", | ||
"react/jsx-runtime", | ||
"@mysten/sui.js", | ||
"@mysten/sui.js/client", | ||
"@mysten/sui.js/bcs", | ||
"@mysten/sui.js/utils", | ||
"@mysten/sui.js/verify", | ||
"@mysten/sui.js/transactions", | ||
], | ||
output: { | ||
// Provide global variables to use in the UMD build | ||
// for externalized deps. | ||
globals: { | ||
react: 'React', | ||
'react-dom': 'ReactDOM', | ||
'@mysten/sui.js': 'Sui' | ||
react: "React", | ||
"react-dom": "ReactDOM", | ||
"react/jsx-runtime": "react/jsx-runtime", | ||
"@mysten/sui.js": "Sui", | ||
"@mysten/sui.js/client": "Sui", | ||
"@mysten/sui.js/bcs": "Sui", | ||
"@mysten/sui.js/utils": "Sui", | ||
"@mysten/sui.js/verify": "Sui", | ||
"@mysten/sui.js/transactions": "Sui", | ||
}, | ||
}, | ||
}, | ||
}, | ||
css: { | ||
modules: { | ||
localsConvention: "camelCase", | ||
}, | ||
}, | ||
esbuild: { | ||
target: "es2020", | ||
pure: mode === "production" ? ["console.log", "debugger"] : [], | ||
}, | ||
optimizeDeps: { | ||
esbuildOptions: { | ||
target: "es2020", | ||
}, | ||
}, | ||
plugins: [ | ||
react(), | ||
vanillaExtractPlugin(), | ||
viteSvgr(), | ||
visualizer({ | ||
open: false, // This opens the visualization in your browser after the build | ||
filename: "bundle-analysis.html", // The output file for the report | ||
}), | ||
], | ||
})); |
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 +1,2 @@ | ||
coverage/ | ||
coverage/ | ||
bundle-analysis.html |
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
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.
7c64cab
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
wallet-kit-with-nextjs-app-router – ./examples/with-next-app-router
wallet-kit-with-nextjs-app-router-suiet.vercel.app
wallet-kit-with-nextjs-app-router.vercel.app
wallet-kit-with-nextjs-app-router-git-main-suiet.vercel.app
7c64cab
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
wallet-kit-demo – ./examples/with-vite
wallet-kit-demo.vercel.app
wallet-kit-demo-git-main-suiet.vercel.app
wallet-kit-demo-suiet.vercel.app