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

Does not work in single var statement defining multiple variables #25

Closed
jgillich opened this issue May 19, 2014 · 8 comments
Closed

Does not work in single var statement defining multiple variables #25

jgillich opened this issue May 19, 2014 · 8 comments

Comments

@jgillich
Copy link

The example provided in the README works fine, but the following does not:

var fs = require('fs'),
    html = fs.readFileSync('./robot.html', 'utf8');
console.log(html);

// Compiled to:
var html = fs.readFileSync('./robot.html', 'utf8');
console.log(html);

I am not sure if this is a browserify limitation or an actual bug though.

@avetisk
Copy link

avetisk commented May 22, 2014

Actually it seems to be linked to this issue:

var fs = require('fs');
window.fs = fs;

This will throw an error:

Error: unsupported type for static module: AssignmentExpression
at expression:

  window.fs = fs

This seems to prevent request from working.

@jgillich
Copy link
Author

@avetisk I don't think these are related. Why are you trying to reassign fs? It isn't available at runtime anyway.

@avetisk
Copy link

avetisk commented May 22, 2014

Actually, I'm not, I was just monkey-testing to find out why request wasn't working.

Within request, fs === {} thus I'm getting a undefined is not a function error in mime.js :/

@jgillich
Copy link
Author

That's because mime doesn't support brfs: broofa/mime#61 (comment)

@avetisk
Copy link

avetisk commented May 22, 2014

ARG.

@ghost
Copy link

ghost commented May 31, 2014

I made a bunch of progress toward the multi-var use-case upstream in static-module 0.0.9 but your particular use-case still doesn't work.

@avetisk
Copy link

avetisk commented May 31, 2014

@substack do you have an idea where the bug comes from?

@mattdesl
Copy link
Collaborator

Testing brfs@1.4.0 with the following and not able to reproduce this bug:

var fs = require('fs'),
  data = fs.readFileSync('./data.txt', 'utf8')
console.log(data)

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

3 participants