kgierke / formkit-inputs

Collection of inputs for FormKit.
https://kgierke.github.io/formkit-inputs/
MIT License
13 stars 1 forks source link

Package distribution improvements #5

Closed justin-schroeder closed 2 years ago

justin-schroeder commented 2 years ago

Wanted to give this a try on a project using laravel mix and was unable to run it:

image

Bunding for package distribution can be a pain. Here are a few things that might help:

  1. An export map in packages.json:
{
  ...
  "exports": {
    ".": {
      "import": "./dist/index.mjs",
      "require": "./dist/index.cjs",
      "types": "./dist/index.d.ts"
    }
  }
}
  1. A module key in your package.json, like:
  "module": "dist/index.mjs",
  1. Rollup into a single .mjs and a .cjs file. You can use rollup for this (admittedly a pain).
kgierke commented 2 years ago

Thanks for the info, yeah had a quick look into this in the beginning and wanted to postpone this. But apparently it can't wait any longer. Will try to fix this by tomorrow.

kgierke commented 2 years ago

Added Rollup to support this, it should now work as expected.