Why Create React App Should Not Compile Non‑Standard Syntax in node_modules
The article explains that compiling experimental JavaScript features like JSX or class properties inside node_modules tightly couples libraries to build tools, leading to breaking changes, coordination overhead, and prolonged upgrade pain, which is why Create React App avoids such compilation.
On March 5 days ago, Create React App released version 2.0.1, introducing a new feature that allows Babel to compile new JavaScript syntax found in node_modules , such as ES6/ES7.
We only compile valid JavaScript syntax in node_modules . JSX is not valid JavaScript, yet it is being used here. The reason for this stance is that compiling non‑standard syntax tightly couples libraries to the build tool. If JSX changes in Babel 8, all libraries using JSX would break, requiring coordinated updates and new major releases. Allowing experimental features also blurs boundaries; many developers use JSX, class properties, decorators, etc. Maintaining a list of supported transformations becomes a moving target as standards evolve, leading to repeated breaking changes. Consequently, when Babel 8 introduces different class‑property behavior, developers must audit every dependency to see whether they expect the old or new semantics, preventing seamless upgrades and causing months of pain for React Native users. This is why we do not compile non‑standard syntax in node_modules .
The original discussion can be found at the linked GitHub issue comment.
UC Tech Team
We provide high-quality technical articles on client, server, algorithms, testing, data, front-end, and more, including both original and translated content.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.