Allow to use this library directly without extra configuration
See original GitHub issueIs your feature request related to a problem? Please describe.
Currently the library as published on NPM appears to be in the Commonjs format which requires configuration step to ensure code in node_modules
-directory gets transpiled so it can be used.
The following error occurs:
node_modules/restful-react/lib/index.js:1
(function (exports, require, module, __filename, __dirname) { import Get from "./Get";
^^^
SyntaxError: Unexpected identifier
at new Script (vm.js:74:7)
at createScript (vm.js:246:10)
at Object.runInThisContext (vm.js:298:10)
at Module._compile (internal/modules/cjs/loader.js:657:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
Describe the solution you’d like
I think it would be suffice to compile the library in both commonjs
and umd
format, well I even think umd
format should already work. I have been looking into the project and it looks like it uses quite old version of a bunch of dependencies but at the same time it seems to use rollup to convert shell node scripts to commonjs
format while not the actual library files itself.
I think a solution would be to update the rollup config so it’s converting the *.js outputted by tsc
in the root of the lib
-directory to umd and then the ones in lib/bin
-directory to commonjs
to make them work out of the box in Node.js (I assume that’s the reason)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:9 (4 by maintainers)
Correct! We can definitely close this issue, thanks for let discover tsdx, it’s very nice 👌
@TejasQ / @weyert I’ve been working recently on a library that uses TSDX which has been great since there’s not much config required.
However, seems I’m a bit late to the party as @weyert’s PRs are already there so I’m happy to put the time in assisting with either approach if required. 👍