You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The file loader currently copies my-img.png into the output folder, and includes its path in the bundle as a string:
constimg_default='./my-img-KWEBOZZ6.png';
I'd instead need a copy loader that would copy the file (like the file loader does) but, instead of turning it into a string, preserves it as an import statement:
importimgfrom'./my-img-KWEBOZZ6.png';
The reason for that is that I'm post-processing my Esbuild through Webpack to address the lack of CJS bundle splitting (it's roughly 2x slower, but still vastly better than pure Webpack builds); if the imports aren't preserved, Webpack won't know about the asset and the final output will be missing it.
The text was updated successfully, but these errors were encountered:
I didn't find the exact solution, but in our project we have a Lerna-based monorepo. So we moved assets to a separate package and then on production made the assets package external. (There are still some issues with WebWorkers though)
Let's say I have an image I reference via
import
:The
file
loader currently copiesmy-img.png
into the output folder, and includes its path in the bundle as a string:I'd instead need a
copy
loader that would copy the file (like thefile
loader does) but, instead of turning it into a string, preserves it as animport
statement:The reason for that is that I'm post-processing my Esbuild through Webpack to address the lack of CJS bundle splitting (it's roughly 2x slower, but still vastly better than pure Webpack builds); if the imports aren't preserved, Webpack won't know about the asset and the final output will be missing it.
The text was updated successfully, but these errors were encountered: