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

Rollup 3 #749

Closed
hyrious opened this issue Oct 20, 2022 · 5 comments
Closed

Rollup 3 #749

hyrious opened this issue Oct 20, 2022 · 5 comments
Labels

Comments

@hyrious
Copy link

hyrious commented Oct 20, 2022

Upgrading to rollup 3 could slightly decrease the bundle size for CJS with --treeshake:

Rollup Repl 2.79.1

Rollup Repl 3.2.3
removed Object.defineProperty(exports, '__esModule', { value: true });

There're a few built-in rollup plugins in tsup currently prevents our upgrading:

  • @rollup/plugin-json: 👍 5.0.0 available
  • rollup-plugin-dts : 👍 5.0.0 available
  • rollup-plugin-hashbang: ❓ need investigate

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar
@egoist egoist closed this as completed in 9ce5c13 Nov 3, 2022
@github-actions
Copy link

github-actions bot commented Nov 3, 2022

🎉 This issue has been resolved in version 6.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@freddydrodev
Copy link

after upgrading to version 6.4.0 my bundle size has been reduced from 1.05 Mb to 279Kb almost 4x

amitdahan pushed a commit to amitdahan/tsup that referenced this issue Dec 25, 2022
@csantos1113
Copy link
Contributor

csantos1113 commented Jan 9, 2023

I'm having an issue after upgrading to 6.4.0 bundling to CJS.

Here is a simplified version of my react code:

// Component.tsx

import ReactSelect from 'react-select';

const Comp = (props) => {
  return <ReactSelect {...props} />
}
// tsup.config.ts

export default {
  bundle: true,
  clean: true,
  dts: true,
  format: ['cjs', 'esm'],
  minify: false,
  sourcemap: true,
  splitting: true,
  target: 'es2022',
  treeshake: 'smallest'

The generated CJS file with tsup v6.3.0 was working ✅

var ReactSelect = require('react-select');
var ReactSelect__default = /*#__PURE__*/_interopDefaultLegacy(ReactSelect);

var Comp = (props) => {
  return /* @__PURE__ */ jsxRuntime.jsx(ReactSelect__default["default"], { ...props });
}

The generated CJS file with tsup v6.4.0 isn't working ⚠️

var ReactSelect = require('react-select');
var Comp = (props) => {
  return /* @__PURE__ */ jsxRuntime.jsx(ReactSelect, { ...props });
}

Do you know if there is additional rollup configuration I need to pass to have rollup resolving default exports properly?

@hyrious
Copy link
Author

hyrious commented Jan 10, 2023

Rollup 3 changed the default output.interop behavior. We'd better set it to auto behind tsup.

@csantos1113
Copy link
Contributor

csantos1113 commented Jan 12, 2023

Rollup 3 changed the default output.interop behavior. We'd better set it to auto behind tsup.

I figured, I've opened a PR with that change: #815

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

No branches or pull requests

3 participants