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

fix(type): rspack function type in cjs require #8169

Merged
merged 11 commits into from
Oct 24, 2024
Merged

fix(type): rspack function type in cjs require #8169

merged 11 commits into from
Oct 24, 2024

Conversation

SoonIter
Copy link
Member

@SoonIter SoonIter commented Oct 18, 2024

Summary

fix the function type in cjs require

close #8095

// in esm
import { rspack } from '@rspack/core';
rspack({ bail: true });

// in cjs
const rspack = require("@rspack/core");
// or const { rspack } = require("@rspack/core");
rspack({ bail: true });

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@github-actions github-actions bot added team The issue/pr is created by the member of Rspack. release: bug fix release: bug related release(mr only) labels Oct 18, 2024
Copy link

netlify bot commented Oct 18, 2024

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit 5db6597
🔍 Latest deploy log https://app.netlify.com/sites/rspack/deploys/6718e7f5c6a0f90008af822a

@SoonIter SoonIter force-pushed the type-fix branch 3 times, most recently from 2d6638b to 5a77ecd Compare October 22, 2024 09:31
@SoonIter SoonIter changed the title fix: the cjs require type and default type fix(type): function type in cjs require Oct 23, 2024
@SoonIter
Copy link
Member Author

This is a solution with a little hack.
Maybe we need to ship both cjs and esm in the future.

@SoonIter SoonIter marked this pull request as ready for review October 23, 2024 12:35
@chenjiahan
Copy link
Member

Maybe we need to ship both cjs and esm in the future.

Agreed, @rspack/core should be a dual package.

@chenjiahan chenjiahan merged commit 11f20e1 into main Oct 24, 2024
32 checks passed
@chenjiahan chenjiahan deleted the type-fix branch October 24, 2024 02:18
@chenjiahan chenjiahan changed the title fix(type): function type in cjs require fix(type): rspack function type in cjs require Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release: bug fix release: bug related release(mr only) team The issue/pr is created by the member of Rspack.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Default export from @rspack/core does not have TypeScript types
2 participants