fix(admin-bundler): Optimize tanstack/react-query (#11112)
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
"@medusajs/admin-shared": "2.3.1",
|
||||
"@medusajs/admin-vite-plugin": "2.3.1",
|
||||
"@medusajs/dashboard": "2.3.1",
|
||||
"@rollup/plugin-node-resolve": "^16.0.0",
|
||||
"@vitejs/plugin-react": "^4.2.1",
|
||||
"autoprefixer": "^10.4.16",
|
||||
"compression": "^1.7.4",
|
||||
|
||||
@@ -34,6 +34,7 @@ export async function getViteConfig(
|
||||
"react-router-dom",
|
||||
"@medusajs/ui",
|
||||
"@medusajs/dashboard",
|
||||
"@tanstack/react-query",
|
||||
],
|
||||
exclude: [...VIRTUAL_MODULES],
|
||||
},
|
||||
|
||||
@@ -12,6 +12,7 @@ interface PluginOptions {
|
||||
export async function plugin(options: PluginOptions) {
|
||||
const vite = await import("vite")
|
||||
const react = (await import("@vitejs/plugin-react")).default
|
||||
const { nodeResolve } = await import("@rollup/plugin-node-resolve")
|
||||
const entries = await glob(`${options.root}/src/admin/**/*.{ts,tsx,js,jsx}`)
|
||||
|
||||
/**
|
||||
@@ -36,11 +37,13 @@ export async function plugin(options: PluginOptions) {
|
||||
const external = new Set([
|
||||
...Object.keys(pkg.dependencies || {}),
|
||||
...Object.keys(pkg.peerDependencies || {}),
|
||||
...Object.keys(pkg.devDependencies || {}),
|
||||
"react",
|
||||
"react-dom",
|
||||
"react/jsx-runtime",
|
||||
"react-router-dom",
|
||||
"@medusajs/admin-sdk",
|
||||
"@tanstack/react-query",
|
||||
])
|
||||
|
||||
/**
|
||||
@@ -60,7 +63,8 @@ export async function plugin(options: PluginOptions) {
|
||||
minify: false,
|
||||
outDir: path.resolve(options.root, options.outDir),
|
||||
rollupOptions: {
|
||||
external: [...external],
|
||||
plugins: [nodeResolve() as any],
|
||||
external: [...external, /node_modules/],
|
||||
output: {
|
||||
globals: {
|
||||
react: "React",
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
"dist"
|
||||
],
|
||||
"dependencies": {
|
||||
"@ariakit/react": "^0.4.1",
|
||||
"@ariakit/react": "^0.4.15",
|
||||
"@dnd-kit/core": "^6.1.0",
|
||||
"@dnd-kit/sortable": "^8.0.0",
|
||||
"@hookform/error-message": "^2.0.1",
|
||||
@@ -50,7 +50,7 @@
|
||||
"@medusajs/js-sdk": "2.3.1",
|
||||
"@medusajs/ui": "4.0.3",
|
||||
"@radix-ui/react-collapsible": "1.1.0",
|
||||
"@tanstack/react-query": "^5.28.14",
|
||||
"@tanstack/react-query": "5.64.2",
|
||||
"@tanstack/react-table": "8.20.5",
|
||||
"@tanstack/react-virtual": "^3.8.3",
|
||||
"@uiw/react-json-view": "^2.0.0-alpha.17",
|
||||
|
||||
Reference in New Issue
Block a user