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

resolveDirectory fails for packages that specify an object in package.json browser field #9

Open
BigDataSamuli opened this issue Nov 12, 2016 · 3 comments

Comments

@BigDataSamuli
Copy link

BigDataSamuli commented Nov 12, 2016

Hi,

Apparently some npm packages (e.g. asap) specify an object in package.json's browser field (see https://github.com/defunctzombie/package-browser-field-spec). This causes small to fail in the Resolve.resolveDirectory function as path.join throws

TypeError: Path must be a string. Received { './asap': './browser-asap.js',
  './asap.js': './browser-asap.js',
  './raw': './browser-raw.js',
  './raw.js': './browser-raw.js',
  './test/domain.js': './test/browser-domain.js' }
    at assertPath (path.js:7:11)
    at Object.join (path.js:468:7)
    ...

Maybe emit a warning and fall back to the main field in these cases, and/or allow selecting the preferred main file (e.g. main or browser)? Or implement the extended browser field spec.

@ivogabe
Copy link
Owner

ivogabe commented Nov 12, 2016

Thanks for reporting, I wasn't aware of that. Small should support objects in the browser field. I have some other business to do the following days. Could you try to create a PR? Otherwise I'll take a look at it next week.

@BigDataSamuli
Copy link
Author

No sorry I don't really need the enhanced browser field functionality and I was actually mostly just testing Small around due to other more well-know module bundlers not really playing well with gulp.

@ivogabe
Copy link
Owner

ivogabe commented Nov 13, 2016

Ok, I'll then take a look at it soon.

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