@acmekit/admin-bundler 2.13.67 → 2.13.68

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +18 -4
  2. package/package.json +6 -5
package/dist/index.js CHANGED
@@ -1140,6 +1140,7 @@ module.exports = __toCommonJS(index_exports);
1140
1140
 
1141
1141
  // src/utils/config.ts
1142
1142
  var import_admin_shared = require("@acmekit/admin-shared");
1143
+ var import_bundler_shared = require("@acmekit/bundler-shared");
1143
1144
  var import_path = __toESM(require("path"));
1144
1145
 
1145
1146
  // src/plugins/inject-tailwindcss.ts
@@ -1314,6 +1315,18 @@ async function getViteConfig(options) {
1314
1315
  const hmrOptions = getHmrConfig(hmrPort);
1315
1316
  const allowedHosts = getAllowedHosts();
1316
1317
  const root = import_path.default.resolve(process.cwd(), ".acmekit/client");
1318
+ const resolvePackageDist = (pkg) => {
1319
+ try {
1320
+ const pkgJson = require.resolve(`${pkg}/package.json`, {
1321
+ paths: [process.cwd()]
1322
+ });
1323
+ return import_path.default.resolve(import_path.default.dirname(pkgJson), "dist");
1324
+ } catch {
1325
+ return null;
1326
+ }
1327
+ };
1328
+ const watchPackages = ["@acmekit/ui", "@acmekit/dashboard", "@acmekit/js-sdk"];
1329
+ const watchDirs = watchPackages.map((pkg) => resolvePackageDist(pkg)).filter(Boolean);
1317
1330
  const backendUrl = options.backendUrl ?? "";
1318
1331
  const frontendUrl = options.frontendUrl ?? options.storefrontUrl ?? "";
1319
1332
  const appName = options.appName ?? void 0;
@@ -1322,6 +1335,7 @@ async function getViteConfig(options) {
1322
1335
  const baseConfig = {
1323
1336
  root,
1324
1337
  base: options.path,
1338
+ cacheDir: import_path.default.resolve(process.cwd(), "node_modules/.vite/acmekit-admin"),
1325
1339
  build: {
1326
1340
  emptyOutDir: true,
1327
1341
  outDir: import_path.default.resolve(process.cwd(), options.outDir)
@@ -1333,12 +1347,11 @@ async function getViteConfig(options) {
1333
1347
  "react-dom/client",
1334
1348
  "react-router-dom",
1335
1349
  "react-i18next",
1336
- "@acmekit/ui",
1337
- "@acmekit/dashboard",
1338
- "@acmekit/js-sdk",
1339
1350
  "@tanstack/react-query"
1340
1351
  ],
1341
- exclude: [...import_admin_shared.VIRTUAL_MODULES]
1352
+ // Watched workspace packages must be excluded from pre-bundling so
1353
+ // moduleGraph.invalidateAll() + full-reload picks up their changes.
1354
+ exclude: [...import_admin_shared.VIRTUAL_MODULES, ...watchPackages]
1342
1355
  },
1343
1356
  define: {
1344
1357
  __BASE__: JSON.stringify(options.path),
@@ -1356,6 +1369,7 @@ async function getViteConfig(options) {
1356
1369
  ...allowedHosts && { allowedHosts }
1357
1370
  },
1358
1371
  plugins: [
1372
+ (0, import_bundler_shared.watchWorkspacePackages)(watchDirs),
1359
1373
  writeStaticFiles2({
1360
1374
  plugins: options.plugins
1361
1375
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acmekit/admin-bundler",
3
- "version": "2.13.67",
3
+ "version": "2.13.68",
4
4
  "description": "Bundler for the AcmeKit admin dashboard.",
5
5
  "author": "Kasper Kristensen <kasper@acmekit.com>",
6
6
  "scripts": {
@@ -18,12 +18,13 @@
18
18
  "package.json"
19
19
  ],
20
20
  "devDependencies": {
21
- "@acmekit/types": "2.13.67"
21
+ "@acmekit/types": "2.13.68"
22
22
  },
23
23
  "dependencies": {
24
- "@acmekit/admin-shared": "2.13.67",
25
- "@acmekit/admin-vite-plugin": "2.13.67",
26
- "@acmekit/dashboard": "2.13.67",
24
+ "@acmekit/admin-shared": "2.13.68",
25
+ "@acmekit/admin-vite-plugin": "2.13.68",
26
+ "@acmekit/bundler-shared": "2.13.68",
27
+ "@acmekit/dashboard": "2.13.68",
27
28
  "@vitejs/plugin-react": "^4.2.1",
28
29
  "autoprefixer": "^10.4.19",
29
30
  "compression": "^1.8.0",