valeriangalliat / fetch-cookie

Decorator for a `fetch` function to support automatic cookie storage and population. 🍪
The Unlicense
135 stars 29 forks source link

Broken support for WebPack's `enhanced-resolve` due to incorrect order of "default" condition in `package.json` "exports" #72

Closed danielweck closed 2 years ago

danielweck commented 2 years ago

Culprit: https://github.com/valeriangalliat/fetch-cookie/blob/b144298b45c4c8e45a38bb9b8cdb176c785a09ad/package.json#L7-L20

Error: "[webpack-cli] ModuleNotFoundError: Module not found: Error: Default condition should be last one"

Origin: https://github.com/webpack/enhanced-resolve/blob/ddc96f8e738690166e7de77ea09c9e5aff52bb1b/lib/util/entrypoints.js#L453-L457

            if (i !== last) {
                if (condition === "default") {
                    throw new Error("Default condition should be last one");
                }
            } 
valeriangalliat commented 2 years ago

Oh wow thanks for reporting. Fixed in 2.0.5!

danielweck commented 2 years ago

Thank you for your quick response! :) Working fine now.