vite-plugin-conditional-imports 0.1.2 → 0.1.3

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 +6 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -271,13 +271,13 @@ function conditionalImports(shouldStrip, options) {
271
271
  }
272
272
  },
273
273
  async writeBundle(options2, bundle) {
274
- if (!pluginRequestedSourcemap || !options2.dir) return;
275
- for (const name of Object.keys(bundle)) {
276
- if (name.endsWith(".map")) {
277
- await unlink(join2(options2.dir, name)).catch(() => {
278
- });
279
- }
274
+ if (!pluginRequestedSourcemap || !options2.dir) {
275
+ return;
280
276
  }
277
+ log("Deleting build-only source maps");
278
+ const dir = options2.dir;
279
+ const toDelete = Object.keys(bundle).filter((name) => name.endsWith(".map")).map((name) => join2(dir, name));
280
+ await Promise.all(toDelete.map((path2) => unlink(path2)));
281
281
  }
282
282
  };
283
283
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-conditional-imports",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Strip conditional imports (only, path patterns, or custom predicate) in production builds and warn on leftover references",
5
5
  "keywords": [
6
6
  "vite",