Skip to content

Commit f96bd13

Browse files
committed
keep(WIP)
1 parent 0d4480d commit f96bd13

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@
99
"main": "dist/cjs/index.js",
1010
"types": "dist/index.d.ts",
1111
"module": "dist/index.js",
12+
"exports": {
13+
".": {
14+
"types": "./dist/index.d.ts",
15+
"import": "./dist/index.js",
16+
"require": "./dist/cjs/index.js",
17+
"default": "./dist/cjs/index.js"
18+
},
19+
"./package.json": "./package.json"
20+
},
1221
"files": [
1322
"dist",
1423
"lib"

scripts/vite-workaround-for-rollup.mjs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
/**
2+
* This script is a workaround for a compatibility issue between Vite and its dependency, Rollup.
3+
* Specifically, Vite's typescript definitions reference a module ('rollup/parseAst') that is not
4+
* directly resolvable with the default module resolution strategy used in some configurations.
5+
*
6+
* The script copies the necessary Rollup files to the expected locations and updates import paths
7+
* in 'parseAst.d.ts' to ensure Vite can correctly import these types.
8+
*
9+
* This workaround should be removed once the underlying issue with Vite's dependency resolution
10+
* is resolved. Ideally, this would be when Vite or Rollup releases an update that addresses the
11+
* issue directly, making this script unnecessary.
12+
*
13+
* Keep an eye on Vite and Rollup's release notes for an update on this issue.
14+
* https://github.com/rollup/rollup/issues/5199
15+
* https://github.com/vitest-dev/vitest/issues/4567
16+
*/
17+
118
import fs from 'node:fs';
219
import path from 'node:path';
320
import { fileURLToPath } from 'node:url';

tsconfig.cjs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"compilerOptions": {
33
"module": "CommonJS",
4+
"target": "es2017",
45
"outDir": "./dist/cjs",
56
"sourceMap": true,
67
"declarationMap": true,

0 commit comments

Comments
 (0)