Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rollupTypes: true - error during build #72

Closed
Qualterink opened this issue May 13, 2022 · 4 comments
Closed

rollupTypes: true - error during build #72

Qualterink opened this issue May 13, 2022 · 4 comments

Comments

@Qualterink
Copy link

Hi,

when I set attribute 'rollupTypes': true, then I got an error

[vite:dts] Start rollup declaration files...
error during build:
Error: Internal Error: The "default" symbol has a ts.SyntaxKind.ExportAssignment declaration which is not (yet?) supported by API Extractor

You have encountered a software defect. Please consider reporting the issue to the maintainers of this application.

"vite": "^2.9.5",
"vite-plugin-dts": "^1.1.1"

@qmhc
Copy link
Owner

qmhc commented May 14, 2022

Can you provide a reproduce repo?

@Qualterink
Copy link
Author

Hi,

I created a repo

https://github.com/Qualterink/reproduce-errror-vite-plugin-dts

System settings:

Distributor ID: Ubuntu
Description: Ubuntu 20.04.4 LTS
Release: 20.04
Codename: focal

Node - v16.14.2

@qmhc
Copy link
Owner

qmhc commented May 24, 2022

@Qualterink I clone your reproduce repo, and run vite build, it work without any error.

@qmhc qmhc closed this as completed Sep 28, 2022
@evoactivity
Copy link

evoactivity commented Jul 17, 2023

I have just ran into this on 3.2.0. The problem was having hyphens in my name, I guess whitespace characters will also cause the same issue.

import { resolve } from "path";
import { defineConfig } from "vite";
import dts from "vite-plugin-dts";

export default defineConfig({
  build: {
    lib: {
      // Could also be a dictionary or array of multiple entry points
      entry: resolve(__dirname, "src/main.ts"),
      name: "breaks-with-hyphens-here",

      // the proper extensions will be added
      fileName: "this-can-be-hyphenated"
    },
  },
  plugins: [
    dts({
      rollupTypes: true,
      insertTypesEntry: true,
    }),
  ],
  test: {
    coverage: {
      provider: "v8",
    },
  },
});

If I turn off rollupTypes I can see name is used in the file like this

export * from './main'
import breaks-with-hyphens-here from './main'
export default breaks-with-hyphens-here

which is not valid and breaks the rollup action from working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants