Install package.json dependency from git, not npm

Ah, OK. Sorry for misunderstanding!

Hi @MattSidor,

thanks for your report. However, in this particular case, the problem is not with the Glitch platform. If you try exactly the same code on your local machine, it won’t work either.

The reason is that when you use a GitHub dependency instead of a npm package, it might not always work: it depends on whether the repository has been properly configured. Typically, npm packages do not have the proper hooks to work when fetched directly from GitHub. In this case, for example, rheostat needs to be transpiled to be used as a node package. When you fetch it from npm, the maintainers of the package transpile it before uploading it to the npm registry, so it works as expected, but this is not the case when you fetch it directly from GitHub.

If you want to use the GitHub repository for your dependency, you have to manually modify its package.json to make sure the build step is run during the install phase. You also have to make sure all the necessary packages for compilation are installed (which means you’ve to move all the devDependencies to the dependencies field).

Let me know if you need further help :slight_smile:

UPDATE: I am not a webpack expert, but you might also need to remove the node_modules exclude from your webpack.config.js file.

3 Likes

D’oh!! I should have known I was probably doing something wrong with the module import. Thanks so much @etamponi for debugging this for me and giving me a clear breakdown of the problem!

3 Likes