Error in setting up bookshelf with Webpack and React

231 views Asked by At

I am exploring things in react and redux where I am using Bookshelf as an ORM with Node to fetch the data from database. And whenever I use the following configurations and run webpack, I got the following error:-

WARNING in ./~/bookshelf/lib/bookshelf.js Critical dependencies: 278:12-28 the request of a dependency is an expression @ ./~/bookshelf/lib/bookshelf.js

And ...

ERROR in ./~/bookshelf/lib/next/example/init-models.js Module not found: Error: Cannot resolve module 'fluent-record' in G:\projects\redux-1\node_modules\bookshelf\lib\next\example @ ./~/bookshelf/lib/next/example/init-models.js

knexfile.js

module.exports = {
 development: {
  client: 'mysql',
  connection: {
    host: '127.0.0.1',
    user: 'root',
    password: 'password',
    database: 'sample',
    charset: 'utf8'
  },
  pool: {
    min: 2,
    max: 10
  },
  migrations: {
    tableName: 'migrations'
  }
},
production: {
 client: 'mysql',
 connection: {
  database: 'starterpack',
  user: 'mattcasey'
 },
 pool: {
  min: 2,
  max: 10
},
migrations: {
  tableName: 'migrations'
  }
 }
};

bookshelf.js

import bookshelf from 'bookshelf';
import dbConfig from './knexfile';
const knex = require('knex');

const currentConfig = dbConfig[process.env.NODE_ENV || 'development'];
const knexInstance = knex(currentConfig);
const Bookshelf = bookshelf(knexInstance);

Bookshelf.plugin('registry');
Bookshelf.plugin('visibility');

export default Bookshelf;

I have no idea why I'm getting this error.It just seems some problem with bookshelf.

0

There are 0 answers