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

#8 Write transforms : Absolute paths? #8

Open
mdda opened this issue Jul 24, 2014 · 6 comments
Open

#8 Write transforms : Absolute paths? #8

mdda opened this issue Jul 24, 2014 · 6 comments

Comments

@mdda
Copy link

mdda commented Jul 24, 2014

I successfully got the #8 solution going, both with the 'direct' through way, and the 'combining' way. However, there seems to be a problem if the 'main.js' file has an absolute include vs a relative include :

// This fails
//var txt = require("/usr/lib/node_modules/browserify-adventure/problems/writing_transforms/wake.txt");
// This works (assuming the wake.txt is copied from the path above to the local directory
var txt = require("./wake.txt");
console.log(txt);

The verification stage works fine, though I see from your solution source that there's a relative file require there too. Am I crazy, or does something different happen in the case of absolute paths?

@hughsk
Copy link

hughsk commented Jul 26, 2014

@mdda where is your entry script loaded? Absolute paths shouldn't change anything but if you're using a normal (not global) browserify transform, the transform will only be applied to files whose closest package.json file is the same as the entry script's. Try using an absolute path for your copy of wake.txt and if it works, that's the problem :)

@CamiloMM
Copy link

CamiloMM commented Aug 8, 2014

I get this same error, I'm on Windows (7 x64) and I came here looking for why it wasn't working. Copied the text file to local folder and indeed, './wake.txt' works but the absolute path doesn't.

I would have thought it was Windows paths having backslashes... the absolute path (doesn't work) looks like this:

var txt = require('c:\\Arquivos de Programas Portable\\Nodist\\bin\\node_modules\\browserify-adventure\\problems\\writing_transforms\\wake.txt');

But even if I replace \\s with /s (both are valid for Windows), still doesn't work.

This path can be read just fine from the command-line, but when running the script I get a ParseError because the text file was not passed through my ./tr.js.

Anyway, this seems to be a bug in browserify itself... I should go and complain about this to them.

@garygreen
Copy link

@CamiloMM did you manage to fix the issue? I'm experiencing same problem with browserify and windows

@CamiloMM
Copy link

@garygreen Funny thing, I forgot about this issue but am currently using browserify on Windows so this all may have been a bug with browserify-adventure.

@mdda
Copy link
Author

mdda commented Jun 10, 2015

@CamiloMM From what I dimly remember, this wasn't really a browserify issue - it arose because of the way browserify-adventure installs (and refers to itself).

@forivall
Copy link

you need to use the -g flag instead of the -t flag.

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

5 participants