Is it possible to develop Google Chrome extensions using node.js?

node.jsGoogle Chrome-Extension

node.js Problem Overview


I'd like to start developing Google Chrome extension using node.js (since I've already written a "text-to-song" script in node.js, and I'd like to turn it into a Chrome extension.) What would be the most straightforward way of approaching this problem?

node.js Solutions


Solution 1 - node.js

Actually it is. Look at this Developers Live-cast. This is something I've been looking for as well, and this would help you.

This brings your node applications bundled to your browser. Here is the repo!

EDIT:

I've noticed that this old answer of mine keeps getting upvotes now and then (thank you all).

But nowadays I'm more an advocate of using web apps instead of bundling your application into many platforms like the chrome store or whatever. You can check the google's post here and here indicating some directions.

In practice I advise for you to start building a progressive web app (PWA) with offline capabilities using service worker and progressive stuff.

There are plenty of resources around the web nowadays and you can offer a much richer application that may achieve a much broader audience if you do it the right way.

Thanks again, and good coding.

Solution 2 - node.js

Simple answer is NO, unless you can find a way to install node.js with an extension using NPAPI.

Nodejs and a Google Chrome Extension do have a couple things in common i.e they both understand javascript and they both use the v8 javascript engine.

Google Chrome Extension

"Google Chrome Extensions are small software programs that can modify and enhance the functionality of the Chrome browser".

To develop a Google Chrome Extension you should write some javascript and or html/css. Then you can run the extension in your browser.

If you wish for others to download your extension you will have to provide config.json file that describes you extension sets permissions etc.

Nodejs

"Node.js is a platform built on Google Chrome's JavaScript runtime for easily building fast, scalable network applications".

To develop applications in nodejs you write some javascript and or html/css for web applications.

If wish for others to use you application you start you nodejs server and listen for incoming requests.

Summary

Despite some of the similarities a Google Chrome Extension and Nodejs have nothing to with each other. You cannot use them together in some special way outside of the normal client/server communication.

Solution 3 - node.js

You can use a WebPack (GitHub) or Browserify (see handbook) to build web-browser extension based on the node.js code.

With Browserify, to convert your code, you can simply run:

browserify node-code.js -o node-code-out.js

Read more:

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAnderson GreenView Question on Stackoverflow
Solution 1 - node.jswesleycoderView Answer on Stackoverflow
Solution 2 - node.jssaeedView Answer on Stackoverflow
Solution 3 - node.jskenorbView Answer on Stackoverflow