feat: declare exports in package.json (#306)

It lets use `moduleResolution=bundler` in TypeScript applications.
In particular, it lets use it with Storybook and ts-example in this
repository.
development
Thomas Bouffard 2024-01-18 07:44:23 +01:00 committed by GitHub
parent a68c94e892
commit 5ddc8f5af2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 29 additions and 2 deletions

14
package-lock.json generated
View File

@ -25084,9 +25084,23 @@
"name": "@maxgraph/ts-example-built-with-vite",
"license": "Apache-2.0",
"devDependencies": {
"typescript": "~5.3.3",
"vite": "~4.4.12"
}
},
"packages/ts-example/node_modules/typescript": {
"version": "5.3.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz",
"integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=14.17"
}
},
"packages/ts-example/node_modules/vite": {
"version": "4.4.11",
"resolved": "https://registry.npmjs.org/vite/-/vite-4.4.11.tgz",

View File

@ -13,6 +13,17 @@
],
"module": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
".": {
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"./css/*": "./css/*",
"./images/*": "./images/*",
"./package.json": "./package.json"
},
"files": [
"css",
"dist",

View File

@ -9,8 +9,7 @@
/* Bundler mode */
"allowJs": true,
// TODO restore bundler - require exports in the package.json of @maxgraph/core
"moduleResolution": "Node",
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,

View File

@ -2,12 +2,14 @@
"name": "@maxgraph/ts-example-built-with-vite",
"license": "Apache-2.0",
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc --version && tsc && vite build --base ./",
"preview": "vite preview"
},
"devDependencies": {
"typescript": "~5.3.3",
"vite": "~4.4.12"
}
}

View File

@ -3,6 +3,7 @@
"compilerOptions": {
"useDefineForClassFields": true,
"sourceMap": true,
"moduleResolution": "bundler",
"resolveJsonModule": true,
"noEmit": true,
"noUnusedLocals": true,