vite-plugin-rebundle 1.2.5 → 1.2.7

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.
package/dist/rebundle.js CHANGED
@@ -89,6 +89,7 @@ export class Rebundle extends $utils.Unit {
89
89
  entryPoints: [chunkPath],
90
90
  bundle: true,
91
91
  minify: false,
92
+ keepNames: true,
92
93
  allowOverwrite: true,
93
94
  });
94
95
  if (result.errors.length > 0)
@@ -140,7 +141,7 @@ export class Rebundle extends $utils.Unit {
140
141
  await this.removeDirectoryIfEmpty(dir);
141
142
  }
142
143
  // Notify about changed chunks
143
- if (changedChunkNames.length > 0) {
144
+ if (ws && changedChunkNames.length > 0) {
144
145
  ws.clients.forEach(client => client.send(JSON.stringify(changedChunkNames)));
145
146
  }
146
147
  };
@@ -166,6 +167,10 @@ export class Rebundle extends $utils.Unit {
166
167
  return this.ws;
167
168
  if (!this.port)
168
169
  throw this.never;
170
+ if (!this.config)
171
+ throw this.never;
172
+ if (!this.config.build.watch)
173
+ return null;
169
174
  this.ws = new $ws.WebSocketServer({ port: this.port });
170
175
  return this.ws;
171
176
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-rebundle",
3
- "version": "1.2.5",
3
+ "version": "1.2.7",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "imkost",
@@ -13,9 +13,7 @@
13
13
  "dev": "rm -rf dist && tsc --watch",
14
14
  "build": "rm -rf dist && tsc",
15
15
  "lint": "tsc --noEmit",
16
- "release": "npm version patch && npm run release:raw",
17
- "release:raw": "npm run build && npm publish",
18
- "release:minor": "npm version minor && npm run release:raw"
16
+ "release": "sh -c 'npm version ${1:-patch} && npm run build && npm publish' --"
19
17
  },
20
18
  "exports": {
21
19
  "import": "./dist/index.js"
package/readme.md CHANGED
@@ -6,8 +6,6 @@ A Vite plugin that guarantees **one standalone file per entry point**. Each entr
6
6
 
7
7
  Sometimes you need bundles without dynamic imports. Vite/Rollup don’t provide this option when building with multiple entries. This plugin solves it by rebundling Vite’s output with esbuild to enforce single-file output.
8
8
 
9
- > ℹ️ Useful when targeting environments that require standalone files (e.g., browser extensions, legacy systems, or file-based distribution).
10
-
11
9
  > ⚠️ This plugin runs **only during** `vite build`. It does not affect the Vite dev server.
12
10
 
13
11
  ## Installation
@@ -38,7 +36,7 @@ export default defineConfig({
38
36
  })
39
37
  ```
40
38
 
41
- ### Options
39
+ ## Options
42
40
 
43
41
  You can provide **esbuild options per entry point**. This is useful, for example, to inject custom define variables into specific bundles:
44
42