You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/lib/ not being ES5 is causing a problem when I try to use coffeescript as a library in my create-react-app based webapp. To be clear, I'm making something like the "Try Coffeescript" tab on coffeescript.org, not just trying to use Coffeescript to write the app itself in.
See #4501. You’re going to want to do something like is described in that PR, where the module is imported into your project such that it can be compiled for browser use. That PR made such a thing possible: use the browser entrypoint in package.json. Your build pipeline that’s already transpiling your code for browser use should be able to import this and process it with the rest of your code.
As part of the issues that led up to #4501 we discussed whether lib should be transpiled, or a separate folder transpiled, but the consensus was not to do so. The CoffeeScript NPM module is primarily a Node module (of course) and it explicitly supports Node 6 and above, which is pretty far back for Node. The thinking was that providing a browser-ready entrypoint would be good enough for people, sparing us the need to maintain another set of output files for every version.
The create-react-app project recommends publishing all modules to npm as ES5. See https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#npm-run-build-fails-to-minify.
/lib/ not being ES5 is causing a problem when I try to use coffeescript as a library in my create-react-app based webapp. To be clear, I'm making something like the "Try Coffeescript" tab on coffeescript.org, not just trying to use Coffeescript to write the app itself in.
To reproduce the issue, see https://github.com/jaredp/cs2-as-a-library-demo. The commits are:
create-react-app
+npm eject
coffeescript
+coffee-loader
in webpackAt the 3rd commit,
npm build
fails, even thoughnpm start
(dev mode) works.The text was updated successfully, but these errors were encountered: