Skip to content

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

Merged
chenjiahan merged 11 commits intomainfrom
type-fix
Oct 24, 2024
Merged

fix(type): rspack function type in cjs require#8169
chenjiahan merged 11 commits intomainfrom
type-fix

Conversation

@SoonIter
Copy link
Copy Markdown
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
@netlify
Copy link
Copy Markdown

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
Copy Markdown
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
@SoonIter SoonIter requested a review from chenjiahan October 23, 2024 12:35
@chenjiahan
Copy link
Copy Markdown
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
@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