SpiriitLabs / vite-plugin-svg-spritemap

Vite plugin to generate svg spritemap
MIT License
47 stars 4 forks source link

Import Assertion Error #2

Closed simeonoff closed 1 year ago

simeonoff commented 1 year ago

I'm gettin import assertion errors when trying to use this plugin.

Steps to reproduce:

  1. Create a new vanilla vite project with typescript
  2. In vite.confit.ts use the plugin as described in the readme
  3. Observe the node log

The following error gets thrown:

failed to load config from /Users/simeonoff/Projects/tmp/svg-sitemap-test/vite.config.ts
error during build:
TypeError [ERR_IMPORT_ASSERTION_TYPE_MISSING]: Module "file:///Users/simeonoff/Projects/tmp/svg-sitemap-test/node_modules/svg-element-attributes/index.json" needs an import assertion of type "
json"
    at new NodeError (node:internal/errors:400:5)
    at validateAssertions (node:internal/modules/esm/assert:82:15)
    at defaultLoad (node:internal/modules/esm/load:84:3)
    at nextLoad (node:internal/modules/esm/loader:163:28)
    at ESMLoader.load (node:internal/modules/esm/loader:605:26)
    at ESMLoader.moduleProvider (node:internal/modules/esm/loader:457:22)
    at new ModuleJob (node:internal/modules/esm/module_job:64:26)
    at #createModuleJob (node:internal/modules/esm/loader:480:17)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:434:34)
    at async ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:79:21)
Applelo commented 1 year ago

Thanks for the issue, I have succeed to reproduce the error. I have checked your PR, it will work but it will broke the compatibility with Node 14 (it is the current version supported by Vite 4). I will check to fix this issue in the following days.