Browserify/nwjs/chrome plugin throws Cannot read property ‘prototype’ of undefined

Am I packaging this incorrectly? I suspect there is some trouble stitching these three solutions together but I’m unable to pinpoint it.

//shortcut.js
var nw = require('./node_modules/nwjs/nw');
var gui = nw.gui;
var option = {
  key : "Ctrl+J",
  active : function() {
    console.log("Global desktop keyboard shortcut: " + this.key + " active.");
  },
  failed : function(msg) {
    console.log(msg);
  }
};

var shortcut = new gui.Shortcut(option);

gui.App.registerGlobalHotKey(shortcut);

at this point it’s a simple command (I think):

browserify shortcut.js –outfile bundle.js

but upon reloading the extension, it throws the error

“Cannot read property ‘prototype’ of undefined”

The line in question is this
ReadStream.prototype = Object.create(fs$ReadStream.prototype)
Which looks like fs is not being properly bundled. From what I understand fs is pretty tightly coupled to node?

Mesh Networking in the Chrome/Firefox Extension Evnviorment

I’m currently making a Chrome/Firefox Extension, and the extension needs to make a BLE Mesh Network using the computer’s Bluetooth capabilities. Is this possible is Pure JS, or do you have to use Browserify to get Node.JS working on a chrome extention and use the AnyMesh Library. Is it not possible at all? Please help

Is it possible to run Node.js modules on browser using Chrome extension

For my college project, I’m creating a Chrome extension to perform certain checks and validations for each URL the user visits on his browser. My aim is to alert the user when a suspicious site is detected using Chrome extension. So for this purpose, I need to use certain NPM modules such as whois-json, get-ssl-certificate and so on. So, since Node.js cannot run on the browser directly, I tried using Browserify module to convert this Node.js code such as require and module execution into plain Javascript bundle file. So, when I try to run this Javascript bundle using the Chrome extension, I get an error as:

“net.connect()” is not a function

Is there any possible way to fix this error? Or can I use another solution as an alternative to Browserify to run my Node.js modules on the Chrome Extension.

How to build chrome extension css files before publishing?

I build a simple chrome extension and would like to publish it.

The problem is, I don’t know how to proceed with some css files.

I used browserify and yarn to install bulma.

in my main.js I got the following line:

import Styles from './styles.css'

and the first line of styles.css looks like this:

@import '../node_modules/bulma/css/bulma.css';

Here’s my build command from package.json

cross-env NODE_ENV=production browserify -g envify -t cssify src/main.js  | uglifyjs -c warnings=false -m > dist/build.js

and my index.html (popup.html)



  
    
    
  
  
    

It works fine if I build it locally. But the only file generated is src/build.js. If I delete node_modules folder, the popup obviously look not good.