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

cannot support @rollup/plugin-babel #9751

Closed
7 tasks done
zjjjjjjjjjjd opened this issue Aug 19, 2022 · 10 comments
Closed
7 tasks done

cannot support @rollup/plugin-babel #9751

zjjjjjjjjjjd opened this issue Aug 19, 2022 · 10 comments

Comments

@zjjjjjjjjjjd
Copy link

Describe the bug

babel tranform es6 is bad, look this:
image

that is right in rollup:
image

Reproduction

https://stackblitz.com/edit/vitejs-vite-xcsg9e

System Info

System:
    OS: macOS 12.5
    CPU: (8) x64 Apple M1 Pro
    Memory: 66.13 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 14.19.1 - /usr/local/bin/node
    Yarn: 1.22.18 - /usr/local/bin/yarn
    npm: 8.13.2 - /opt/homebrew/bin/npm
  Browsers:
    Firefox: 103.0.2
    Safari: 15.6

Used Package Manager

yarn

Logs

No response

Validations

@zjjjjjjjjjjd
Copy link
Author

use library mode

@zjjjjjjjjjjd
Copy link
Author

zjjjjjjjjjjd commented Aug 19, 2022

maybe commonjs plugin usage should before rollup plugins

@poyoho
Copy link
Member

poyoho commented Aug 19, 2022

I'm not particularly clear about your needs, but I think plugin-legacy can help you.

@bluwy
Copy link
Member

bluwy commented Aug 21, 2022

Are you referencing the require("./node_modules/@babel/runtime-corejs3/core-js-stable/promise.js"); part? Because that does look weird. But also if you're building a library, it's usually not needed to run babel unless the output is intended to be consumed as is, e.g. a CDN.

@zjjjjjjjjjjd
Copy link
Author

I'm not particularly clear about your needs, but I think can help you.plugin-legacy

plugin-legacy cannot support library mode :(

@flieks
Copy link

flieks commented Aug 25, 2022

i am also interested in using babel with rollup
i tried vite-plugin-babel but i think it does not play well with build.lib (build as library).
For my specific case i want to use Lit to package my app as a custom-element
@zjjjjjjjjjjd is this somewhat the same as your needs ?

@sapphi-red
Copy link
Member

For plugin-legacy not supporting library mode, see #1639.

@zjjjjjjjjjjd
Please make it clear what is expected.
But I believe you'll need to use getBabelOutputPlugin instead.
https://github.com/rollup/plugins/blob/master/packages/babel/README.md#running-babel-on-the-generated-code

@zjjjjjjjjjjd
Copy link
Author

vite-plugin-babel

sorry, I will use vue2

@sapphi-red
Copy link
Member

Closing as I feel this is a question and not a bug. Also because there wasn't any clarification about the issue.

@sapphi-red sapphi-red closed this as not planned Won't fix, can't repro, duplicate, stale Sep 1, 2022
@zjjjjjjjjjjd
Copy link
Author

For plugin-legacy not supporting library mode, see #1639.

@zjjjjjjjjjjd Please make it clear what is expected. But I believe you'll need to use getBabelOutputPlugin instead. https://github.com/rollup/plugins/blob/master/packages/babel/README.md#running-babel-on-the-generated-code

this works!

@github-actions github-actions bot locked and limited conversation to collaborators Sep 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants