4 ms·
Yeah, sorry but I don't buy that. webpack outputs JavaScript bundles, not a dependency graph. Importing PNGs into JavaScript is only useful if you use a JavaScr
by Touche 8y ago
Yeah, sorry but I don't buy that. webpack outputs JavaScript bundles, not a dependency graph. Importing PNGs into JavaScript is only useful if you use a JavaScript AST to then do something with those imports.
- fenomas 8y agoI'm not selling it, and I don't follow what you're disagreeing with. Webpack can output JS bundles, but it understands dependencies between non-JS assets as well, and will process any file in the dependency graph any way you like. As such the point of requiring a PNG into JS (or CSS, or a Vue/React component, etc) is to tell webpack there's a dependency on it. Then that image will get pulled in to the build process for entry points that need it, and not otherwise.