Skip to content

Commit

Permalink
chore: main/module/exports in package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
Menci committed Dec 10, 2023
1 parent f02fb9f commit e0a4eaf
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion exports/import.mjs
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
import { default as m } from "../dist/index.js";
export default m.default;
export default typeof m === "function" ? m : m.default;
3 changes: 2 additions & 1 deletion exports/require.cjs
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
module.exports = require("../dist/index");
module.exports = require("../dist/index").default;
module.exports.default = require("../dist/index").default;
3 changes: 3 additions & 0 deletions exports/require.d.cts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import type _default from "../dist/index.d.ts";
declare const _export: typeof _default & { default: typeof _default };
export = _export;
14 changes: 10 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@
"name": "vite-plugin-top-level-await",
"version": "1.4.0",
"description": "Transform code to support top-level await in normal browsers for Vite.",
"main": "dist/index.js",
"main": "./exports/require.cjs",
"module": "./exports/import.mjs",
"exports": {
"types": "./dist/index.d.ts",
"import": "./exports/import.mjs",
"require": "./exports/require.cjs"
"import": {
"types": "./dist/index.d.ts",
"default": "./exports/import.mjs"
},
"require": {
"types": "./exports/require.d.cts",
"default": "./exports/require.cjs"
}
},
"repository": "https://github.com/Menci/vite-plugin-top-level-await",
"author": "Menci <[email protected]>",
Expand Down

0 comments on commit e0a4eaf

Please sign in to comment.