使用Webpack和React

时间:2017-01-05 14:38:43

标签: node.js reactjs webpack bookshelf.js

我正在探索react和redux中的东西,我使用Bookshelf作为带有Node的ORM来从数据库中获取数据。每当我使用以下配置并运行webpack时,我都会收到以下错误: -

  警告./~/bookshelf/lib/bookshelf.js关键依赖关系:278:12-28依赖关系的请求是表达式@ ./~/bookshelf/lib/bookshelf.js

而且......

   /bookshelf/lib/next/example/init-models.js中的错误   找不到模块:错误:无法在G:\ projects \ redux-1 \ node_modules \ bookshelf \ lib \ next \ example @ ./~/bookshelf/lib/next/example/init-models中解析模块'fluent-record'。 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;

我不知道为什么我会收到这个错误。这似乎与书架有些问题。

0 个答案:

没有答案