I have building a small app with Node.js and Koa. I am using the Cloud9 IDE and I can run my application directly from Cloud 9 without any problems. I am trying to deploy onto Heroku (via github). However, I am receiving errors when the application starts on Heroku that I cannot fix. I think it is a problem with how I have setup the directories and Heroku can't find the dependancy modules but I am new to Node/Koa and can't figure out how to correct this. My code is here: https://github.com/infornite/n4nite-api
Webpack.config.js
const webpack = require('webpack');
const path = require('path');
const fs = require('fs');
const externals = fs.readdirSync('node_modules')
.filter(x => ['.bin'].indexOf(x) === -1)
.reduce((obj, mod) => {
obj[mod] = 'commonjs ' + mod;
return obj;
}, {});
externals['koa-neo4j/check'] = 'commonjs koa-neo4j/check';
externals['koa-neo4j/preprocess'] = 'commonjs koa-neo4j/preprocess';
externals['koa-neo4j/postprocess'] = 'commonjs koa-neo4j/postprocess';
externals['koa-neo4j/debug'] = 'commonjs koa-neo4j/debug';
externals['koa-neo4j/util'] = 'commonjs koa-neo4j/util';
const plugins = [];
const config = {
target: 'node',
entry: {
'./server': './src/server.js'
},
devtool: 'source-map',
output: {
path: './',
filename: '[name].js',
library: '[name]',
libraryTarget: 'umd',
umdNamedDefine: true
},
externals: externals,
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /(node_modules)/,
loader: 'babel-loader'
}
]
},
resolve: {
extensions: ['.js']
},
plugins: plugins
};
module.exports = config;
Package.json
{
"name": "n4nite-api",
"version": "0.1.0",
"description": "An API for the Infornite Metadata Management Tool",
"credits": "koa-neo4j-starter-kit / Keyvan Mir Mohammad Sadeghi <keyvan.m.sadeghi@gmail.com>",
"main": "server.js",
"jsnext:main": "./src/server.js",
"scripts": {
"lint": "./node_modules/.bin/eslint ./src --fix",
"dev": "./node_modules/.bin/webpack --progress --colors --watch",
"build": "./node_modules/.bin/webpack",
"start": "npm run build && DEV=1 node $NODE_DEBUG_OPTION server.js",
"serve": "npm run build && node server.js"
},
"author": "Keyvan Mir Mohammad Sadeghi <keyvan.m.sadeghi@gmail.com>",
"devDependencies": {
"babel": "^6.5.2",
"babel-cli": "^6.11.4",
"babel-core": "^6.13.2",
"babel-eslint": "^6.1.2",
"babel-loader": "^6.2.4",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-syntax-async-functions": "^6.13.0",
"babel-plugin-syntax-object-rest-spread": "^6.13.0",
"babel-plugin-transform-es2015-arrow-functions": "^6.8.0",
"babel-plugin-transform-es2015-destructuring": "^6.9.0",
"babel-plugin-transform-es2015-for-of": "^6.8.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.14.0",
"babel-plugin-transform-es2015-modules-umd": "^6.12.0",
"babel-plugin-transform-es2015-parameters": "^6.11.4",
"babel-plugin-transform-es2015-spread": "^6.8.0",
"babel-plugin-transform-object-rest-spread": "^6.8.0",
"babel-plugin-transform-regenerator": "^6.14.0",
"babel-plugin-transform-runtime": "^6.12.0",
"babel-plugin-transform-strict-mode": "^6.11.3",
"babel-preset-es2015": "^6.6.0",
"babel-preset-stage-0": "^6.5.0",
"babel-register": "^6.7.2",
"coffee-loader": "^0.7.2",
"eslint": "^3.3.1",
"eslint-loader": "^1.5.0",
"eslint-plugin-babel": "^3.3.0",
"webpack": "^2.1.0-beta.27"
},
"dependencies": {
"koa-neo4j": "^1.0.0"
}
}