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

$.map is not a function in browser #66

Open
catb0t opened this Issue May 2, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@catb0t

catb0t commented May 2, 2016

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?

@luciechan

This comment has been minimized.

Show comment
Hide comment
@luciechan

luciechan Sep 12, 2016

I have the same problem.
I included the browser-bundle.js generated by lispy -b (I am using Node 4.5.0 LTS btw)
on my HTML page, with a simple Hello World LispyScript

index.html

<!DOCTYPE html>
<html>
<head>
    <title>LispyScript Test</title>
    <script src="browser-bundle.js"></script>
    <script type="text/lispyscript" id="main" src="main.ls">
</head>
<body>
</body>
</html>

main.ls

;; Hello World! in LispyScript.
(console.log "Hello LispyScript!")

On my Chrome JavaScript console, It shows the very same error

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

luciechan commented Sep 12, 2016

I have the same problem.
I included the browser-bundle.js generated by lispy -b (I am using Node 4.5.0 LTS btw)
on my HTML page, with a simple Hello World LispyScript

index.html

<!DOCTYPE html>
<html>
<head>
    <title>LispyScript Test</title>
    <script src="browser-bundle.js"></script>
    <script type="text/lispyscript" id="main" src="main.ls">
</head>
<body>
</body>
</html>

main.ls

;; Hello World! in LispyScript.
(console.log "Hello LispyScript!")

On my Chrome JavaScript console, It shows the very same error

Uncaught TypeError: $.map is not a function
(anonymous function) @ browser-bundle.js:4040
(anonymous function) @ browser-bundle.js:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment