kreuzerk / svg-to-ts

Build performant SVG icon libraries by converting raw SVG files to TypeScript that is optimized for modern tree shaking mechanisms.
MIT License
272 stars 44 forks source link

Run within a module repository #213

Open Garbee opened 1 year ago

Garbee commented 1 year ago

I seem to only be able to run the generator when the type is set to commonjs. Setting the package type to module always causes a configuration error, even if the config is named .cjs to force the commonjs loader.

Example: https://github.com/Garbee/material-icons

Steps to reproduce:

  1. git clone --recursive git clone --recursive https://github.com/Garbee/material-icons.git icons-test
  2. cd icons-test
  3. npm ci
  4. npm run icons

Does anyone know of a way to make this work while in a module package? Or will we need to change back to commonjs when running this for the time being?

I did some digging earlier and it looks like cosmiconfig is looking for maintainers and no longer actively maintained. There are some issues around module loading upstream. So this could be a non-issue here technically. However, an alternative config loader should be looked into if that is the case and cosmiconfig isn't actively maintained.

rajsite commented 6 months ago

cosmiconfig landed support for cjs in 8.2.0 so all that's needed is a cosmiconfig dep version bump! https://github.com/cosmiconfig/cosmiconfig/issues/224#issuecomment-1575677337