jaridmargolin / bouncefix.js

🚫 Stop full body elastic scroll bounce when scrolling inside nested containers (IOS)
http://jaridmargolin.github.io/bouncefix.js/
84 stars 15 forks source link

Problem with name of module #5

Closed sekoyo closed 6 years ago

sekoyo commented 10 years ago

You have called your module bouncefix.js but this is against CommonJS rules which specify:

Module identifiers may not have file-name extensions like ".js".

http://wiki.commonjs.org/wiki/Modules/1.1

So your module cannot actually be required in..

I think this may also cause a problem:

var Fix = require('fix'); var utils = require('utils');

AFAIK these should be relative since they aren't external modules and are in the same directory?

var Fix = require('./fix'); var utils = require('./utils');

jaridmargolin commented 10 years ago

You are correct about paths. The library files are created using AMD and converted to commonjs modules during build. I am aware of how to fix this issue, and will submit ASAP.

As for the name... NPM also discourages using a js extension.

Don't put "js" or "node" in the name. It's assumed that it's js, since you're writing a package.json file, and you can specify the engine using the "engines" field.

I however have not run into issues while using this naming scheme. NPM allows me to publish, and node is able to resolve. It is possible that other commonjs implementations (browserify, etc..) do not play as nice. I have not tested.

With over 100,000 registered npm modules and a handful of bower components, naming has been a nightmare. I have chosen to prepend the .js extension to all of my libraries in an attempt to avoid conflicts. It has not bitten me yet (although it may at some point).