browserify / browser-resolve

resolve function which support the browser field in package.json
MIT License
102 stars 70 forks source link

Fails when package.json main string doesn't match browser source file #37

Closed JamesKyburz closed 10 years ago

JamesKyburz commented 10 years ago

If the main entry string and browser source don't match main isn't replaced, even though they are the same relative file.

eg

 "main": "audio.js",
  "browser": {
    "./audio.js": "./webaudio.js"
  }

The problem is index.js#L177

gist show how author can be fooled

Found this issue when attempting to browserify level-browserify

defunctzombie commented 10 years ago

When replacing main the recommended approach is to use the string syntax and not the object syntax

"main": "audio.js",
"browser": "./webaudio.js"

However, yes this should still work and is a bug!

JamesKyburz commented 10 years ago

I agree, found when trying to browserify level-browserify

Pull request minutes away

On Wednesday 16 April 2014 at 21:07, Roman Shtylman wrote:

When replacing main the recommended approach is to use the string syntax and not the object syntax "main": "audio.js", "browser": "./webaudio.js"

However, yes this should still work and is a bug!

— Reply to this email directly or view it on GitHub (https://github.com/defunctzombie/node-browser-resolve/issues/37#issuecomment-40639307).