Parcel supports CoffeeScript automatically using the
@parcel/transformer-coffeescript plugin. When a
.coffee file is detected, it will be installed into your project automatically.
URL constructor combined with
import.meta.url. This can be used to reference URLs such as images, workers, service workers, and more.
CoffeeScript does not currently support
import.meta. Instead, you can use the CommonJS
__filename variable with the
file: prefix to convert it to a URL. For example, here's how you could create a worker in CoffeeScript:
new Worker new URL('worker.js', 'file:' + __filename),
The same goes for other types of dependencies like images:
img = document.createElement 'img'
img.src = new URL 'hero.jpg', 'file:' + __filename