Skip to content

@svgr/core imports @svgr/babel-preset without specifying it as a dependency #781

@emillaine

Description

@emillaine

🐛 Bug Report

@svgr/core imports @svgr/babel-preset:

import type { Options as TransformOptions } from '@svgr/babel-preset'

but doesn't specify it as a dependency:

"dependencies": {
"@svgr/plugin-jsx": "^6.3.1",
"camelcase": "^6.2.0",
"cosmiconfig": "^7.0.1"
},
"devDependencies": {
"@types/svgo": "^2.6.3"
}

For the user, this causes the following error in node_modules/@svgr/core/dist/index.d.ts:

TS2307: Cannot find module '@svgr/babel-preset' or its corresponding type declarations.

and consequently Options is imported as type any.

This causes Config["template"] to have type any for the user (imported as import type { Config } from "@svgr/core";).

To Reproduce

-

Expected behavior

@svgr/core defines @svgr/babel-preset as a dependency (or other appropriate fix), so that Config["template"] has correct type instead of any.

Link to repl or repo (highly encouraged)

-

Run npx envinfo --system --binaries --npmPackages @svgr/core,@svgr/cli,@svgr/webpack,@svgr/rollup --markdown --clipboard

## System:
 - OS: macOS 12.6
 - CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
 - Memory: 1.73 GB / 32.00 GB
 - Shell: 5.8.1 - /bin/zsh
## Binaries:
 - Node: 16.16.0 - /usr/local/bin/node
 - Yarn: 1.22.19 - /usr/local/bin/yarn
 - npm: 8.11.0 - /usr/local/bin/npm
## npmPackages:
 - @svgr/core: 6.3.1 => 6.3.1 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions