coffeescript icon indicating copy to clipboard operation
coffeescript copied to clipboard

CoffeeScript ESM loader

Open usrtax opened this issue 1 year ago • 4 comments

fix https://github.com/jashkenas/coffeescript/issues/5401

image

❯ cat test.coffee
#!/usr/bin/env coffee

console.log 1
❯ cat package.json
{
  "type": "module"
}
❯ node -v
v18.7.0
❯ node --loader "../loader.mjs" test.coffee
(node:28894) ExperimentalWarning: Custom ESM Loaders is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)

usrtax avatar Aug 01 '22 09:08 usrtax

Thanks, there’s also https://github.com/nodejs/loaders-test/tree/main/coffeescript-loader which is more of the reference implementation (did you base yours off of this, or of the example in the Node docs?).

I need to work out how to handle ESM in general in the project before we can land this. Probably add an "exports" field, etc.

GeoffreyBooth avatar Aug 01 '22 23:08 GeoffreyBooth

谢谢,还有https://github.com/nodejs/loaders-test/tree/main/coffeescript-loader更多的参考实现(你的基础是这个,还是节点文档中的示例? )。

我需要弄清楚如何在项目中处理 ESM,然后才能实现它。可能会添加一个"exports"字段等。

this can use with CommonJS , but coffeescript-loader can't

image i write this base on nodejs documents , but there is error to use code in nodejs documents when use nodejs 18.7.0

usrtax avatar Aug 02 '22 03:08 usrtax

i write a new version there https://github.com/iuser-dev/nodejs-loader/blob/main/src/index.coffee

this version can both use import './xx.coffee' or import './xx'

usrtax avatar Aug 05 '22 13:08 usrtax

@usrtax What is coffee_plus?

STRd6 avatar Oct 15 '22 15:10 STRd6