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.

Why does this library has npm package?

See original GitHub issue

Hi,

I used this package in the browser and it works great.

When I realized that it is also available as npm package. I was wondering why and how we can use it on the server side.

I also saw this code in github project page:

// CommonJS:
const dat = require('dat.gui');

// ES6:
import * as dat from 'dat.gui';

If I am not wrong the above both are serverside JS programming similar to NodeJS, can’t be used in the browser unless we build them with browserify or rollup.

My question is why is this package available in npm? Is there any use cases of using it in server side?

With regards, Nithin B.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
MacroMancommented, Apr 17, 2019

I’m not really sure what you’re confused by, as you seem to have answered your own question. You wouldn’t use this on the server side, it’s just an example of how to load the library in ES6 and/or extend it’s functionality, which can then be compiled to run in a browser, hence you can install it with npm.

0reactions
donmccurdycommented, Apr 18, 2019

This library doesn’t officially run serverside in Node.js. With some (a lot) of work you could perhaps hotpatch it to function, but I wouldn’t be able to tell you how to do so sorry. And just generating HTML is not enough… you still need JS to make the GUI interactive, and so the dat.gui package needs to be in the client anyway.

So, the npm package exists purely for users who want to use dependency management to build their browser-side packages as @MacroMan mentions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

libraries - npm
Why? This project was created in response to ember-cli #2177. It aims to make it easier and more flexible to configure libraries to...
Read more >
How to Create an npm Package Ready to Distribute - Bugfender
When you create an npm library you will create a json file called package.json in which you specify which dependencies your JS library...
Read more >
Publish Your First Node Library Using NPM - Live Code Stream
If you are a Node.js developer, using npm packages won't be a new concept to you. From complex npm packages like express to...
Read more >
NPM is installing lots of libraries - node.js - Stack Overflow
npm prior to version 3.x installs libraries in a tree structure, so each library has its own node_modules and so on.
Read more >
Using the npm library - Vev Help Center
npm is the package manager for Node.js, a back-end JavaScript runtime environment. The npm Registry is a public collection of packages of open-source...
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