bluwy / publint

Lint packaging errors
https://publint.dev
MIT License
932 stars 19 forks source link

Improve browser field suggestion #59

Closed sapphi-red closed 11 months ago

sapphi-red commented 11 months ago

I think my wordings are not good so feel free to completely rewrite the message😅

bluwy commented 11 months ago

Great idea. I didn't thought of using "import" for the "browser" field, that's really neat.

I think the texts looks good, but I'll give a fresher look tomorrow before merging. Thanks!

bluwy commented 11 months ago

Pushed some docs tweak, I actually wonder now if we should rename USE_EXPORTS_OR_IMPORTS_BROWSER to USE_IMPORTS_BROWSER instead 🤔 Seems like in most case, the migration doesn't need to touch the "exports" field.

sapphi-red commented 11 months ago

I didn't include in the example in the docs, but in the following example, it's more straightforward to use exports field instead of imports field.

{
  "module": "./module.js",
  "browser": {
    "./module.js": "./module.browser.js"
  }
}
{
  "exports": {
    ".": {
      "module": {
        "browser": "./module.browser.js",
        "default": "./module.js"
      }
    }
  }
}
bluwy commented 11 months ago

Hmm true. I'll update the docs with a little more example then so the "exports" part is clearer.

bluwy commented 11 months ago

Thanks!