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
When CoffeeScript is used in a project with a Cordova/Desktop (Electron) build target, all the classes are turned into functions for those builds. This creates problems when a CoffeeScript class tries to extend a JavaScript class.
This is not a problem on a normal web build (Meteor.isModern returning true) where CoffeeScript classes translate to JavaScript classes. However, in a Desktop build (Meteor.isModern returning false), the result of a class declaration is a function.
Even worse, JavaScript classes (defined in .js files) do NOT get turned into functions in the Desktop build, leading to this incompatibility. However, if one includes a JavaScript class in a .cs file (using the embedded JavaScript syntax), that class will get turned into a function.
I'm assuming the problem then boils down to these lines in the CoffeeScript compiler:
// CoffeeScript contains a handful of features that output as ES2015+,// such as modules, generator functions, for…of, and tagged template// literals. Because they’re too varied to detect, pass all CoffeeScript// compiler output through the Babel compiler.constdoubleRoastedCoffee=this.babelCompiler.processOneFileForTarget(inputFile,output.js);
Since Babel doesn't seem to be converting JavaScript classes in .js files into functions (even on Cordova/Desktop platforms), is there a way that the CoffeeScript compiler wouldn't be turning them either?
The text was updated successfully, but these errors were encountered:
I believe this is expected since when building a non-modern/legacy bundle, classes doesn't exist, and to proper functions are converted. But I can't see why uses legacy to compile in Cordova/Electron.
It would be nice to have a small reproduction repository where we can quickly try out to explore any ideas of possible solutions. Since I have more questions on the specific setup which I am not familiar with.
When CoffeeScript is used in a project with a Cordova/Desktop (Electron) build target, all the classes are turned into functions for those builds. This creates problems when a CoffeeScript class tries to extend a JavaScript class.
This is not a problem on a normal web build (
Meteor.isModern
returning true) where CoffeeScript classes translate to JavaScript classes. However, in a Desktop build (Meteor.isModern
returning false), the result of a class declaration is a function.Even worse, JavaScript classes (defined in .js files) do NOT get turned into functions in the Desktop build, leading to this incompatibility. However, if one includes a JavaScript class in a .cs file (using the embedded JavaScript syntax), that class will get turned into a function.
I'm assuming the problem then boils down to these lines in the CoffeeScript compiler:
Since Babel doesn't seem to be converting JavaScript classes in .js files into functions (even on Cordova/Desktop platforms), is there a way that the CoffeeScript compiler wouldn't be turning them either?
The text was updated successfully, but these errors were encountered: