lvarayut / relay-fullstack

:point_up::running: Modern Relay Starter Kit - Integrated with Relay, GraphQL, Express, ES6/ES7, JSX, Webpack, Babel, Material Design Lite, and PostCSS
https://lvarayut.github.io/relay-fullstack/
MIT License
986 stars 126 forks source link

Wrong include with subroutes #23

Closed d-winter closed 8 years ago

d-winter commented 8 years ago

Hi,

first thanks for this awesome project! It's a huge help for me starting with relay!

I have changed the routes so there is now a subroute with a a route with a subroute:

export default (
  <Route path='/' component={AppContainer} queries={ViewerQuery}>
    <Route path='projects'>
      <Route name='tables' path=':projectId' component={TableListContainer} queries={ProjectQuery} />
    </Route>
    <Route path='/login' component={LoginComponent} />
  </Route>
);

When I hit the route, there is an 404 error: http://localhost:3000/projects/vendor.js http://localhost:3000/projects/app.js

The index.html is loaded correctly, but the includes of the both js files points into the projects folder... I am not really familiar with webpack, but I think the problem is there? Hope anybody can give me an advice how to solve this.

Thanks in advance! Daniel

lvarayut commented 8 years ago

Hey Daniel, thanks for reporting. In the webpack.config.js at line 62, could you try to add publicPath property as following:

  ...
  output: {
    path: path.join(__dirname, 'build'),
    publicPath: '/',                                     // Add this line
    filename: '[name].js'
  },
  ...

Then, run npm start again. Let me know if it worked.

d-winter commented 8 years ago

Ok, got it working. I have changed this line:

  output: {
    path: path.join(__dirname, 'build'),
    filename: '/[name].js'
  }

Hope this helps. Thanks a lot!