Comments (4)
The latest version of assign-deep
is using es6 features like the spread operator (...
) which I don't think uglifyjs
handles. There are plugins for either uglifyjs
, babel
or webpack
(things that are used in create-react-app
that should be able to handle es6 features. I'm not sure where to look in the create-react-app
documentation to find that information, but I think you could start there.
I'm going to close this issue because I think this is a bundling question.
from assign-deep.
@doowb All I can do is quote their recommendation:
Some third-party packages don't compile their code to ES5 before publishing to npm. This often causes problems in the ecosystem because neither browsers (except for most modern versions) nor some tools currently support all ES6 features. We recommend to publish code on npm as ES5 at least for a few more years.
If you are jumping to ES6-only "early", I think you should at least include a note in README.md stating this, or telling people to stick with 0.4.7
for ES5 support. As it is right now, it's not so friendly.
For what it's worth they are working on create-react-app 2.x (in next
branch) which includes "ES6-compatible Uglify":
facebook/create-react-app#3815
But, there are going to be a lot of people stuck on 1.x for a while, since 2.x is still only in alpha.
from assign-deep.
Most (almost all) of the modules that we've published are targeted at node and we use the engine
property in package.json
to specify which node version is supported. Since this library targets node 6, which was released over 2 years ago, I don't think we're "jumping to ES6-only early".
If we decided that we should add a build step to pre-transpile our modules, which browsers should they target? If we only target for the oldest browsers, then that adds a ton of extra code for browsers that don't need it. If we have specific builds for different browser targets, then create-react-app
will still break because some browsers support some es6 features that uglifyjs
doesn't handle. Also, pre-transpiling means that more files are published to npm, which will cause node_modules
to grow in size. This is something else that some people don't like to see.
I've read through some of the issues on create-react-app
and it seems like you can "eject" the webpack config and include all node_modules
or maybe pick specific ones to transpile. I think this is better for a user to do since they have the choice of how the modules get transpiled and which browsers to target.
As for including a note in the README, I think this is something that we might have to start doing since more people are using node modules in browsers. We have templates that can be updated to include this information and possibly suggest ways to configure builds.
from assign-deep.
@doowb I understand your position. It's fine, you just need to document it. Then nobody can complain that the new version broke their build, since it was documented.
Everyone who can't have ES6 modules in this way can just stick with the old version. If you actually make bug fixes to only the 1.x code, it's going to be sad for anyone stuck on the old version though.
This is likely partially why the create-react-app devs suggest "publishing as ES5 for a few more years".
I've read through some of the issues on create-react-app and it seems like you can "eject" the webpack config and include all node_modules or maybe pick specific ones to transpile. I think this is better for a user to do since they have the choice of how the modules get transpiled and which browsers to target.
I can tell you that ejecting in create-react-app is something to be avoided for as long as is humanly possible. You really don't want to eject unless you have no choice, since it means you can't easily integrate all the lovely new changes that create-react-app adds in new versions. Half the point of create-react-app is to abstract away the build tools madness.
from assign-deep.
Related Issues (14)
- Webpack compilation is not compatible HOT 10
- crashes on this object HOT 3
- Difference between this and mixin-deep? HOT 6
- Throw error when string or number passed accidentally? HOT 2
- Functions aren't getting overridden? HOT 6
- Shouldn't assign-deep mutate dates? HOT 5
- cann't assign to an empty object HOT 1
- Is there a way to stop it HOT 1
- Changelog HOT 1
- Breaks on arrays HOT 7
- Please upgrade to the latest version to get a critical bugfix
- Multiple arguments overwrites values in arguments HOT 4
- Type definitions HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from assign-deep.