GrapesJS / grapesjs

Free and Open source Web Builder Framework. Next generation tool for building templates without coding
https://grapesjs.com
BSD 3-Clause "New" or "Revised" License
22.37k stars 4.05k forks source link

BUG: Missing type declaration from exports in package.json #5398

Closed padcom closed 1 year ago

padcom commented 1 year ago

GrapesJS version

What browser are you using?

chrome

Reproducible demo link

https://github.com/padcom/grapesjs-import-error

Describe the bug

0.21.6 changed the way things are exported and now VSCode doesn't see type declarations:

image

It happens when TypeScript uses:

  "compilerOptions": {
    "module": "ESNext",
    "moduleResolution": "bundler",
    "strict": true
  }

which is the default setting in @vue/tsconfig/tsconfig.json used in all Vue.js applications and also it is the default in all vite.js templates.

That's how it should look in https://github.com/GrapesJS/grapesjs/blob/dev/package.json#L12:

  "exports": {
    ".": {
      "import": "./dist/grapes.mjs",
      "require": "./dist/grapes.min.js",
      "types": "./dist/index.d.ts"
    },
    "./*": "./*"
  },

Code of Conduct

padcom commented 1 year ago

PR: https://github.com/GrapesJS/grapesjs/pull/5399