Skip to content

Remove source-map from browser build#1571

Merged
ai merged 1 commit intopostcss:mainfrom
barak007:source-map-browser
May 5, 2021
Merged

Remove source-map from browser build#1571
ai merged 1 commit intopostcss:mainfrom
barak007:source-map-browser

Conversation

@barak007
Copy link
Copy Markdown

@barak007 barak007 commented May 5, 2021

Since path is false in browsers build the source-map package is actually not in use*.

This PR adds "source-map": false to the package.json also added explicit protection for the existence of the source-map API's.
Now if one will want to use postcss in browser and support source maps he will need to include path and source-map packages

This will decreased the bundle size of postcss by ~27% (from 29KB to 21KB)

(*) There is only one feature that I wasn't sure what to do with related to fromJSON. It is using the PreviousMap (no problem there) and PreviousMap uses the source-map package and I wasn't sure how to fallback. It might be a super edge case for browsers.

@ai
Copy link
Copy Markdown
Member

ai commented May 5, 2021

fromJSON is a rare feature (I think only Parcel i using it).

@ai ai merged commit b158dd5 into postcss:main May 5, 2021
@ai
Copy link
Copy Markdown
Member

ai commented May 5, 2021

Do you have Twitter account to mention you in release tweet?

@barak007
Copy link
Copy Markdown
Author

barak007 commented May 5, 2021

No Twitter. maybe I should open one

@ai
Copy link
Copy Markdown
Member

ai commented May 5, 2021

Thanks. Released in 8.2.14.

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

Successfully merging this pull request may close these issues.

2 participants