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.

Install from npm the built file is not compiled to es5.

See original GitHub issue

Describe the bug Just install the npm pkg, the files inside lib folder is not compatible into es5… I can see import etc syntax in lib folder.

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)

To Reproduce just install from npm.

Expected behavior Should work in browsers

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
chilijungcommented, Sep 21, 2018

I found a workaround of this issue in nextjs, I’m in a tight deadline for our project. I don’t have time to dig in further codebases. However, I’ll create PRs for features and fixes of restful-react if needed for my use case, thanks.

1reaction
fabien0102commented, Sep 20, 2018

Totally agree to introduce rollup and --target es5 or build --for umd. We already have an open issue for this https://github.com/contiamo/operational-scripts/issues/20 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

npm module should be precompiled to ES5 #7850 - GitHub
I edit the ES6+ source code and reload the app. One thing that's especially important is that the code is not stale. With...
Read more >
Webpack not converting ES6 to ES5 - node.js - Stack Overflow
So I did some research and I found babel-loader. However, I'm not sure what I'm doing. I ran npm install babel-loader --save-dev and...
Read more >
JavaScript needs the compile step (on install) - Gleb Bahmutov
We all pretend that JavaScript is unique because it does not require a build or compile step on the client. Yet, this is...
Read more >
are-you-es5 - npm
A package to help you find out which of your `node_modules` aren't ES5 so you can add them to your transpilation steps.
Read more >
Compile and build TypeScript code using npm - Microsoft Learn
For a Node.js project, you can install the TypeScript npm package using the command line or the IDE. To install using the IDE,...
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