Skip to content

$.map is not a function in browser #66

@catb0t

Description

@catb0t

Using the browser-bundle.js generated by lispy -b and the following directory structure:

├── browser-bundle.js
├── index.html
├── serve.js
├── serve.ls
└── square.ls

Where index.html and square.ls are the same as http://lispyscript.com/docs/#browserrunning, and serve.js looks like:

#!/usr/bin/env js
// Generated by LispyScript v1.0.0
var http = require('http');
var url = require('url');
var fs = require('fs');
var path = require('path');
var port = (process.argv[2] || 1337);
var baseDir = __dirname;
(http.createServer(function(request,response) {
    return (function() {
    try {
        var reqUrl = url.parse(request.url);
        var fsPath = [baseDir,path.normalize(reqUrl.pathname)].join('');
        response.writeHead(200,{"Content-Type": "text/html"});
        var fStream = fs.createReadStream(fsPath);
        fStream.pipe(response);
        return fStream.on('error',function(err) {
            response.writeHead(404);
            return response.end();
        });

    } catch (e) {
    return (function(err) {
        response.writeHead(500);
        response.end();
        return console.log(e.stack);
    })(e);
    }
    })();
})).listen(port);
console.log("listening on port",port);

Running ./serve.js will print listening on port 1337, but the loaded page http://localhost:1337/index.html will log an error:

Uncaught TypeError: $.map is not a function
  (anonymous function) @ browser-bundle.js:4040
  (anonymous function) @ browser-bundle.js:40

Any pointers? Am I missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions