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

Cannot require dist/geotiff.js #23

Open
ernoaapa opened this issue Apr 4, 2017 · 3 comments
Open

Cannot require dist/geotiff.js #23

ernoaapa opened this issue Apr 4, 2017 · 3 comments

Comments

@ernoaapa
Copy link
Contributor

ernoaapa commented Apr 4, 2017

Hi!
We're having problems to use the distribution version of geotiff. Looks like the compiled versions in the dist directory doesn't work with module.exports syntax anymore.
If I require those files, node returns just empty object and for example the parse is not available.

How to reproduce

Open node console and try to require file under dist

[ernoaapa:~]$ node
> require('./node_modules/geotiff/dist/geotiff.js')
{}

Same thing happens with the minified version.

Versions

Geotiff: 0.3.6
Node: 5.10.1, 6.10.0 and 7.7.4

@constantinius
Copy link
Member

I can confirm this issue, I'll investigate

@constantinius
Copy link
Member

Okay, it seems obvious that the browserified build cannot simply be loaded by node. Have you tried to load the source module itself? (ie: src/main.js)

I'm trying to find an idiomatic way to deliver a built version for vanilla JS and had hoped that browserify would satisfy both node and browsers.

Another option is to include the babel translation of every module alongside the browserify build.

@constantinius
Copy link
Member

Okay, I prepared a new version (v0.4.1) in which I tried to fix this issue. Now the whole tree is run though babel and saved in the dist/ folder (which is done automatically on publish, so all you have to do is to update to the new version and require('geotiff') and everything should work smoothly.
The downside is, that the browserify build now has the browserify part in the name: geotiff.browserify.js and geotiff.browserify.min.js.

Please try the new version and tell me if this works out for you.

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

2 participants