这是indexloc提供的服务,不要输入任何密码
Skip to content

Tsup fails to generate dts with --dts-only mode when there are scss files imported in my entry #554

@laozhu

Description

@laozhu

Hello, @egoist I encount a problem with dts-only usage.

  1. I use vite to bundle my react-app with scss
  2. I want to use tsup to bundle my types to single dts file

But tsup will failed to work because it can't parse scss file in my component.

My CLI

tsup src/index.ts --dts-only -d dist

Error Message

> @easynm/react-gallery@1.0.0 build-dts /Users/Ritchie/Developer/@easynm/cloud/components/react-gallery
> tsup src/index.ts --dts-only -d dist

CLI Building entry: src/index.ts
CLI Using tsconfig: tsconfig.json
CLI tsup v5.11.11
DTS Build start
DTS Build error
Error parsing: /Users/Ritchie/Developer/@easynm/cloud/components/react-gallery/src/styles/react-gallery.scss:1:0
Unexpected character '@' (Note that you need plugins to import files that are not JavaScript)
1: @keyframes gallery-loading-spinner {
   ^
2:   0% {
3:     transform: rotate(0deg);
 ELIFECYCLE  Command failed with exit code 1.
 ELIFECYCLE  Command failed with exit code 1.

What I want

I want to ignore less/scss parse when I use --dts-only option, hope for ur help, Happly Lunar New Year 🐯

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions