codesandbox / dependency-packager

Other
238 stars 62 forks source link

ignore blacklisting "module" and "es2015" entries when they specify individual files #3

Closed lxe closed 6 years ago

lxe commented 6 years ago

For example, if we have


  "browser": {
    "./dist/index.js": "./dist/browser.es5.js",
    "./dist/index.es.js": "./dist/browser.es5.es.js"
  },

Like https://github.com/fusionjs/fusion-tokens/blob/master/package.json#L11

codesandbox will thrown an error:

Error: Could not fetch dependencies, please try again in a couple seconds: Something went wrong while packaging the dependency fusion-react@1.1.0: Path must be a string. Received { './dist/browser.es5.es.js': './dist/browser.es2015.es.js' }

codesandbox-pack

Maybe we should blacklist these individual files, but I think this is OK for a short term fix

CompuIves commented 6 years ago

Ohh this is interesting, thanks a lot for the help! So if I understand correctly, we replace the the module or esnext value with browser, but don't check if the browser field is a string?

CompuIves commented 6 years ago

Ah, taking a second look now I see what you mean! Merging it in now, thanks a lot for the contribution!