Closed umezo closed 8 years ago
Can we import a coffee module directly(without converting to js)?
I think yes.
I created tiny coffee project and checked it. https://gist.github.com/umezo/51669e6344b032caf97c
# index.coffee
Ramlev = require 'ramlev'
console.log( new Ramlev ) # -> Ramlev { configuration: undefined, tests: [] }
and ran this script with following command
coffee index.coffee
(actually npm start
)
Then do we still need this PR?
sure! yes please!
I need this PR in work that dont(cant?) use coffee script.
@umezo I mean ramlev already has coffee-script
in deps
of package.json, so it's was expected to work with normal javascript code, as the converting from coffee to js is in runtime.
Current ramlev module can't be found by runtime I checked that with following gist https://gist.github.com/umezo/76f0acf76c241a40d876
//index.js
var ramlev = require('ramlev')
module.js:341
throw err;
^
Error: Cannot find module 'ramlev'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (/............../ramlev-test-require/index.js:1:76)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Function.Module.runMain (module.js:447:10)
my node version is v5.5.0
@umezo I have some code update against this PR. Could you have a try with npm install git://github.com/cybertk/ramlev.git#as-lib
.
@cybertk I tried same code with as-lib branch and it works !
thx!
this change makes ramlev enabled to be required like normal npm module.
after installing ramlev into some project locally, ramlev can be required from other .js files like following code.