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

Error during build with rollupTypes: true, when the lib name having hyphens or whitespace #247

Closed
qmhc opened this issue Jul 17, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@qmhc
Copy link
Owner

qmhc 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 #72.

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.

Originally posted by @evoactivity in #72 (comment)

@qmhc qmhc changed the title 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. Error during build with rollupTypes: true, when the lib name having hyphens or whitespace Jul 17, 2023
@qmhc qmhc added the bug Something isn't working label Jul 17, 2023
@qmhc qmhc closed this as completed in 7cfe2ea Jul 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant