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

Output not being compiled-down #101

Closed
samdenty opened this issue May 11, 2019 · 12 comments · Fixed by #102 or #111
Closed

Output not being compiled-down #101

samdenty opened this issue May 11, 2019 · 12 comments · Fixed by #102 or #111

Comments

@samdenty
Copy link
Contributor

samdenty commented May 11, 2019

Current Behavior

Currently the output is not being transpiled so it can be supported on older browsers eg. class {}.

Suggested solution(s)

Use @babel/preset-env and default to ES2015 output

Additional context

It's problematic because some setups don't transpile node_modules. This prevents extending classes from tsdx as babel doesn't like es5->es6 interop.

@samdenty samdenty changed the title Output not being compiled-down Output not being compiled-down to ES5 May 11, 2019
@samdenty samdenty changed the title Output not being compiled-down to ES5 Output not being compiled-down May 11, 2019
@swyxio
Copy link
Collaborator

swyxio commented May 11, 2019

i think @jaredpalmer has strong feelings about this one. i think it is a good idea to try to ship modern js in libraries and force downstream toolkits to change. any idea why CRA doesnt do the transpile?

edit: looks like CRA v2 does do this! see this long ass issue. facebook/create-react-app#1125 (comment)

the bar has shifted, as Dan says in that issue. “normal setups” should adjust accordingly.

@samdenty
Copy link
Contributor Author

samdenty commented May 11, 2019

@sw-yx Didn't know create-react-app added that. Unfortunately some tools (parcel for one)/custom webpack setups aren't configured out the box to transpile node_modules.

How about keeping preset-env, but adding a browserlist to package.json that targets evergreen by default?

@swyxio
Copy link
Collaborator

swyxio commented May 11, 2019

🤷🏼‍♂️this is jared's call.

@jaredpalmer
Copy link
Owner

Oof. 😐

@alanrsoares
Copy link

I'm also having issues with spread operator not being transpiled

@jaredpalmer
Copy link
Owner

Will investigate in the mornjng

@jaredpalmer
Copy link
Owner

I think this must have to do with cjs settings.

@jaredpalmer
Copy link
Owner

Can someone explore this?

@hedgerh
Copy link
Contributor

hedgerh commented May 24, 2019

I can take a look, but need to gather a little context. Looks like there's a PR to add preset-env? #102

should the output be compiling down, but something's up with the cjs settings?

@jaredpalmer
Copy link
Owner

Honestly I haven’t diagnosed the root issue. What I know right now is that Formik’s old Rollup config was fine (on master), but the tsdx is not for cjs

@hedgerh
Copy link
Contributor

hedgerh commented May 24, 2019

Np. I can hunt for the root issue. I just wanted to confirm what the expected behavior is.

@hedgerh
Copy link
Contributor

hedgerh commented May 24, 2019

Figured it out. There was a tsconfigOverride declared in the typescript rollup plugin that forced target to esnext. Changed it to default to es5 and it can be declared in a tsconfig at the project level. #111

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

Successfully merging a pull request may close this issue.

5 participants