1

I'm developing a client side application and I want to use the browser version of NeDB. Using gulp, I run browserify to create my bundle.js. The problem is when I try to import the browser version of NeDB I face an error about a require inside the nedb.js file.

Here is the require:

var Nedb = require('nedb/browser-version/out/nedb')

The error:

events.js:141
    throw er; // Unhandled 'error' event
    ^

Error: Cannot find module './model' from 'E:\Rafael\Dev\situations\node_modules\nedb\browser-version\out'

Looking for model inside the nedb.js file, I saw that it tries to import using the current directory, but the file is in another one.

The require used by NeDB:

var model = require('./model')

File structure:

nedb
  browser-version
    out
      nedb.js
  lib
    model.js

What am I missing about the NeDB browser version and browserify?

I'm already using browserify with success. I'm able to require modules like angular and foundation. The problem starts when I try to include NeDB.

rcorreia
  • 549
  • 1
  • 9
  • 27

1 Answers1

0

Change it to nedb.min.js might work, this once let me pass browserify :

var Nedb = require('nedb/browser-version/out/nedb.min.js')
Andrew_1510
  • 12,258
  • 9
  • 51
  • 52