Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Public files don’t get served until dev server restarts for the first time #726

Open
cpury opened this issue Oct 10, 2017 · 2 comments
Open

Comments

@cpury
Copy link

cpury commented Oct 10, 2017

(Crosspost from https://forums.meteor.com/t/flow-router-public-files-dont-get-served-until-dev-server-restarts-for-the-first-time/39763)

I have a simple app that uses Flow-Router. In my public directory, there are some files that I'd like to be served. This seems to work always when running meteor without flow router. However, when I start the dev server with my route definitions, the static files are not served at all and result in a 404 no matter how many times I clear the cache and refresh. I have to edit some file to trigger a server restart before it works as expected.

Is there something I can do to debug what's going on? Serving public files is supposed to work out of the box with flow router, right?

Here's my routes.js:

import { FlowRouter } from 'meteor/kadira:flow-router';
import { BlazeLayout } from 'meteor/kadira:blaze-layout';

import '../../ui/layouts/app-body.js';
import '../../ui/pages/index-page.html';
...
import '../../ui/layouts/not-found-body.html'

FlowRouter.route('/', {
  name: 'home',
  action() {
    BlazeLayout.render('appBody', { main: 'indexPage' });
  },
});

// ...
// Two more basic routes that have nothing to with /public or similar
// ...

FlowRouter.notFound = {
  action() {
    BlazeLayout.render('notFoundBody');
  },
};

Other info: The routes are defined similarly to the newest TODO example in /imports/startup/client/routes.js and get imported early on the client-side.

I've used Meteor 1.5 but just upgraded to 1.6-rc.5 and the issue still persists.

@mywebstudio
Copy link

mywebstudio commented Nov 14, 2018

I have the similar issue. But my app crash when i`m trying ti pass any FlowRouter params, like 'id'

FlowRouter.route('/editproduct/:id', {
name: 'editProduct',
action: function(params) {
BlazeLayout.render('pageContent', {wrapper: 'editProduct' });
}
});

without FlowRouter param '/:id' my public files loads correctly in template
Problem always comes up on the initial server start
Meteor -1.8; FlowRouter - 2.1

@mywebstudio
Copy link

mywebstudio commented Nov 24, 2018

Solved. In my case the error was in relative url of static files (css/bootstrap.min.css) loaded as (/editproduct/css/bootstrap.min.css) - that was wrong. Static files should be imported by absolute url like this:
<link href="/css/bootstrap.min.css" rel="stylesheet">

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants