I'm trying to develop a webapp using meteor and Heroku. When I run my code locally everything is fine, but as soon as I deploy it on Heroku, i get:
Cannot find module './navbar/NavBar.js'
or if I get rid of the NavBar in my code:
Cannot find module './component/App'
My project folder looks like:
project
client
main.css
main.html
main.js
component
App.js
Games.js
Home.js
Workbench.js
navbar
NavBar.js
Server
main.js
And this is my code:
main.js
import React from 'react';
import { Meteor } from 'meteor/meteor';
import { render } from 'react-dom';
import App from './component/App';
Meteor.startup(() => {
render(<App />, document.getElementById('root'));
});
App.js
import React from 'react';
import {Container} from 'reactstrap';
import {BrowserRouter as Router, Route} from 'react-router-dom';
import Workbench from './Workbench'
import NavBar from './navbar/NavBar.js'
export default class App extends React.Component {
render(){
return(
<Router>
<div>
<NavBar/>
<Container fluid={true}>
<Route path='/' component={Workbench}/>
</Container>
</div>
</Router>
)
}
}
NavBar.js
import React from 'react';
import {nav} from 'react-bootstrap';
export default class NavBar extends React.Component {
constructor(props){
super(props);
this.state = {
gameList: [{}],
gamesVisibility: false
}
}
render() {
const {gameList, gameVisibility} = this.state;
return (
<div className="sidenav">
<h2 className="sidenav-header"><a href="/">Test project</a></h2>
<ul>
<li onClick={() => this.setState({gameVisibility: !gameVisibility})}> <a className="SideNavTitle">Games</a> {this.renderArrow(gameVisibility)} </li>
{this.renderCollection(gameVisibility, gameList)}
<li className="SideNavItem"><a>Channel</a></li>
<li className="SideNavItem"><a>About</a></li>
</ul>
</div>
);
}
renderCollection(visibility, collection){
if (visibility){
return collection.map((game) => <li id = 'test' className="SideNavSubItem"><a>{game.name}</a></li>)
}
else{
return;
}
}
renderArrow(visibility){
if (visibility){
return <i className="fa fa-arrow-down" aria-hidden="true" style={{color: 'white'}}/>
}
else{
return <i className="fa fa-arrow-right" aria-hidden="true" style={{color: 'white'}}/>
}
}
}
I used heroku run bash
along with cat NavBar.js
to confirm that my file was on heroku as suggested in this post. Its kind of weird since the code work perfectly locally
Edit: The build on Heroku is successful, these errors show when I try to load my page.