question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow to use this library directly without extra configuration

See original GitHub issue

Is 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:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
fabien0102commented, Jan 14, 2020

Correct! We can definitely close this issue, thanks for let discover tsdx, it’s very nice 👌

2reactions
South-Pawcommented, Jan 13, 2020

@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. 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use iCloud Shared Photo Library - Apple Support
On your iPhone or iPad · Open the invitation from the library creator or go to Settings > Photos. · Tap Accept &...
Read more >
Building And Using Static And Shared "C" Libraries
Creating A Static "C" Library Using "ar" and "ranlib"​​ a' and puts copies of the object files "util_file.o", "util_net.o" and "util_math.o" in it....
Read more >
Extending with Shared Libraries - Jenkins
Shared Libraries marked Load implicitly allows Pipelines to immediately use classes or global variables defined by any such libraries.
Read more >
Link Options (Using the GNU Compiler Collection (GCC))
This allows to build shared libraries without position-independent code on architectures where ... The -l option is passed directly to the linker by...
Read more >
Customize permissions for a SharePoint list or library
View the Permissions page in SharePoint · Go to the library or list and open it. · Select Settings Settings icon · On...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found