My project fails with the error message in title on heroku, but it works locally.
This is my webpack.config.js
:
module.exports = { entry: [ './src/index.js' ], output: { path: __dirname, publicPath: '/', filename: 'bundle.js' }, module: { loaders: [{ test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader', query: { presets: ['react', 'es2015', 'stage-0'] } }] }, resolve: { extensions: ['.jsx', '.js'] }, devServer: { historyApiFallback: true, contentBase: './' } };
And this is package.json
:
{ "main": "index.js", "scripts": { "start": "node ./node_modules/webpack-dev-server/bin/webpack-dev-server.js", "test": "mocha --compilers js:babel-core/register --require ./test/test_helper.js --recursive ./test", "test:watch": "npm run test -- --watch" }, "author": "", "license": "ISC", "devDependencies": { "babel-core": "^6.26.0", "babel-loader": "^7.1.2", "babel-preset-es2015": "^6.1.18", "babel-preset-react": "^6.24.1", "babel-preset-stage-1": "^6.24.1", "chai": "^3.5.0", "chai-jquery": "^2.0.0", "jquery": "^2.2.1", "jsdom": "^8.1.0", "mocha": "^2.4.5", "react-addons-test-utils": "^0.14.7" }, "dependencies": { "axios": "^0.17.1", "lodash": "^3.10.1", "react": "^0.14.3", "react-dom": "^0.14.3", "react-redux": "4.3.0", "react-router": "^2.0.1", "react-router-dom": "^4.0.0", "redux": "^3.0.4", "redux-form": "^6.6.3", "redux-promise": "^0.5.3", "validator": "^9.1.2", "webpack": "^3.8.1", "webpack-dev-server": "^2.9.4" } }
I digged around a bit, trying to find an answer, but there was no case such as working on one machine, and not on another machine.
Update 1
Here is index.js
:
import React from 'react'; import ReactDOM from 'react-dom'; import { Provider } from 'react-redux'; import { createStore, applyMiddleware } from 'redux'; import { BrowserRouter, Route, Switch } from 'react-router-dom'; import promise from 'redux-promise'; import reducers from './reducers'; import LoginForm from './components/login_form'; const createStoreWithMiddleware = applyMiddleware(promise)(createStore); ReactDOM.render( <Provider store={createStoreWithMiddleware(reducers)}> <BrowserRouter> <div> <Route path="/" component={LoginForm} /> </div> </BrowserRouter> </Provider> , document.querySelector('.container'));
** Update 2 ** I tried changing the jsx
to js
for the test
property in webpack loader
config object, it didn't help. I removed stage-1
and it's still failing.
1 Answers
Answers 1
This problem got fixed:
- Deleted
module.query
andresolve
from the webpack config file. - Moved dependencies from
devDependencies
todependencies
(heroku is a production environment, and therefore it doesn't downloaddevDependencies
, which doesn't make sense to me !)
0 comments:
Post a Comment