Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

react-components preset should compile down to es5 by default #722

Closed
wlach opened this issue Feb 26, 2018 · 7 comments
Closed

react-components preset should compile down to es5 by default #722

wlach opened this issue Feb 26, 2018 · 7 comments

Comments

@wlach
Copy link
Contributor

wlach commented Feb 26, 2018

If we don't do this, the resulting minified js won't be useable by tools like create-react-app (see e.g. metricsgraphics/react-metrics-graphics#18).

Current suggested workaround (could probably be used as a basis of a solution here):

https://github.com/eliperelman/react-fout-stager/blob/67b13f839701438334863f42b8c859595eb3bf6b/.neutrinorc.js#L13

@edmorley
Copy link
Member

edmorley commented Mar 10, 2018

So IMO libraries like this should provide both an ES6 version (accessible via the module property in package.json) and an ES5 output (accessible via main in package.json).

That said, this really is the territory of rollup (see the vast majority of other libraries that produce multiple variants) - I wonder if it would be a better fit compared to Neutrino/webpack in these cases?

@edmorley
Copy link
Member

@eliperelman thoughts on suggesting people use rollup instead for this use case? I know it means familiarity for people who use Neutrino elsewhere, but I'm not convinced webpack is superior to rollup for this use case.

@eliperelman
Copy link
Member

The superiority may be temporary, and for that reason I don't see why we need to recommend another tool. Documenting the tradeoffs may be good, but we should let users determine whether the tradeoffs warrant the use of another tool over the benefits of shared configuration.

@edmorley
Copy link
Member

Fair point.

The problem at the moment is that there's no one maintaining the preset and it currently generates broken (by best practice standards) output. I don't use this preset or have time to look at it, so I don't see it getting fixed any time soon.

@eliperelman
Copy link
Member

It's not necessarily broken, just that it doesn't work everywhere. If you generate a component, and you use that component in a Neutrino-based React project, it will work. It just doesn't work as-is in a CRA project.

I do use this, though, so I will fix it.

@eliperelman eliperelman self-assigned this Apr 26, 2018
@edmorley
Copy link
Member

Putting !ES5 content in main is broken TBH. It's not expected that everyone runs babel against node_modules (though I imagine in the future more and more people will be putting ES6 in module so everyone will have to include node_modules in babel-loader regardless).

@edmorley
Copy link
Member

edmorley commented Jun 8, 2018

This doesn't block a Neutrino v9 alpha - however since it's a breaking change, someone would need to start working on this soon or else it's not going to make Neutrino 9 final, and would then have to wait until Neutrino 10.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

3 participants