Help with "frozeman/meteor-build-client" tool


#1

Hi everyone! :grinning:

I have been working for some time working with Meteor, and developing for different platforms such as smartwatches and TVs. Recently I was interested in knowing if it is possible to have a Meteor application running only on client side.

After making some research I found the frozeman/meteor-build-client project, which is exactly what I was looking for. However, when using the tool I get the project bundled with its index.html; but when opening it on my browser this is what I get:

Oops, looks like there’s no route on the client or the server for url: “file:///C:/Users/ahc/Desktop/meteor-local-bundle/index.html.”

I have tried by changing the iron router configuration with no results, so I suspect I am doing it wrong. In the project page of the build client it is mentioned something in the last section, related to how to deal with routes, but I don’t get it at all :sweat:

Can you help me to figure out what I am doing wrong with the tool or how to make to have Meteor running only on client side?


#2

Are you testing with Chrome? If so there was a related discussion in the Iron Router repo a little while back, that might help:


#3

Hi, thanks for your answer! Not only with Chrome, but Firefox too, and I get the same error. Using Meteor 1.3.5 in my project.


#4

Try to build without absolute path like

meteor-build-client .build -p \"\" -s settings.json

#5

also you could use a ;ittle hack to test the build locally

Create a folder into project root, like .testserver (name should starts w a dot - it wont hanles w Meteor). Place single js file starting express

// .testserver/index.js
var express = require('express');
var app = express();
var path = require('path')

var rootDir = path.join(__dirname, '../.build');
var indexFile = path.join(rootDir, 'index.html');

app.use(express.static(rootDir));

app.get('/', function(req, res) {
    res.sendFile(indexFile);
});


app.listen(4000, function () {
  console.log('Test server listen on localhost:4000');
});

so next modify your package.json like

{
  "name": "xxx",
  "private": true,
  "version": "0.0.9",
  "main": "index.js",
  "scripts": {
    "start": "meteor run --settings settings.json",
    "build": "meteor-build-client .build -p \"\" -s settings.json",
    "client": "node ./.testserver/main.js",
    "test": "npm run build && npm run client"
  },
  "dependencies": {
    ...
  },
  "devDependencies": {
    ...
    "express": "^4.13.4"
  }
}

for now npm run build builds ur app, npm run client runs last build with express


#6

Hi! Thank you so much for your answer! Yes that was exactly the problem, now I can check it is working properly :slight_smile: