privatenumber / esbuild-loader

💠 Speed up your Webpack with esbuild ⚡️
MIT License
3.58k stars 106 forks source link

Support for Debugging styled-components with esbuild-loader #358

Closed ATakaSKY closed 9 months ago

ATakaSKY commented 9 months ago

Feature request

Currently, styled-components produce hashes in the compiled code, which makes debugging extremely difficult. It would be beneficial to have a solution similar to typescript-plugin-styled-components but compatible with esbuild-loader. This would greatly enhance the developer experience when working with styled-components in projects utilizing esbuild as the bundler.

Motivations

I am currently using ts-loader to compile the codebase with typescript-plugin-styled-components to generate meaningful classnames for easier debugging. While I was trying to move to esbuild-loader, I couldn't find a similar mechanism or a workaround to do the same.

Alternatives

I'm not exactly sure how we would go about doing this but we could try implementing a preprocessing step in webpack that allows for source map generation or some other mechanism to preserve meaningful class names or identifiers in the compiled output. If there's an existing solution, I'd be happy to accept that too.

Additional context

No response

Contributions

privatenumber commented 9 months ago

Fixing the DX of another project sounds out of scope. Why don't you open a feature request with styled-components?

It's also very easy to add a pre-processing step in Webpack by making a loader (like this project). Not sure I see why this should belong in esbuild-loader.