Skip to content

Wrong formats and broken type definitions #836

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

Closed
DaSchTour opened this issue May 16, 2021 · 5 comments
Closed

Wrong formats and broken type definitions #836

DaSchTour opened this issue May 16, 2021 · 5 comments

Comments

@DaSchTour
Copy link

DaSchTour commented May 16, 2021

To but it mildly I'm extremely confused. For a zero configuration bundler there is a lot to do to make it work, while actually it's completely broken.

Typescript definitions are missing files that only include interfaces which leads to broken type definitions.

The esm format is actually not a module format but also just a bundle. I would have expected to see a low transpiled code that can be picked up by another bundler when it is imported as a library in another project.

I would also expect it not to be minified if it's a module format and that it also is not put into one file but actually preserve the module structure.

When using "type": "module" and "main": "./dist/index.cjs", as described in the README all bundles are named index.cjs.js, index.cjs.umd.js and so on. So all references in the package.json are wrong.

@developit
Copy link
Owner

Can you clarify what TypeScript definition you're talking about? This is a CLI, I can't think of how TS has any relevance to it.

The ESM output format generates bundles that use import and export, which is very much ES Modules. It's not clear to me what your expectation was - if a bundler did not bundle code, it wouldn't be a bundler.

Microbundle is explicitly designed to produce minified output - that is effectively the entire premise of the project. Minification can be turned off using the --no-minify option, but doing this essentially reduces Microbundle to an unnecessary abstraction around Rollup.

The CJS thing is a bug that has already been fixed - the docs were updated some time in the last two weeks, but we haven't cut a release yet with the corresponding changes.

It sounds like you are looking for a Rollup configuration and do not want to bundle or minify, in which case Microbundle is simply the wrong tool for the job.

@DaSchTour
Copy link
Author

Yeah, I see. I wonder why there is this unfilled gap between rollup and a bundler. In fact what I see is that microbundle is also only an abstraction around Rollup. And if microbundle only adds the minification I don't get the purpose 😄

@developit
Copy link
Owner

To each their own! The purpose of abstractions like Microbundle is the same as any other abstraction: instead of copy-and-pasting nearly-identical Rollup configurations into each npm module one maintains, the abstraction allows each project to depend on a centralized configuration that can be updated over time without having to manually copy changes between projects.

@rhyek
Copy link

rhyek commented May 21, 2021

When using "type": "module" and "main": "./dist/index.cjs", as described in the README all bundles are named index.cjs.js, index.cjs.umd.js and so on.

Is there a workaround for this? I tried removing "type": "module", but it still happens. I notice that the latest version is from December so I'm wondering if I should use a previous version or if there might be a better solution.

Thanks.

@agilgur5
Copy link
Contributor

agilgur5 commented Sep 17, 2022

Typescript definitions are missing files that only include interfaces which leads to broken type definitions.

Thought I'd update here that I fixed the root cause of this type-only issue upstream in ezolenko/rollup-plugin-typescript2#406, which was released in rpt2 0.34.0

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

No branches or pull requests

4 participants