JSKongress / JS-Kongress-Munich-Deep-Track

This repository collects all session proposals for the #DeepTrack at JS Kongress Munich. See you again in 2021! Take a look on our website for more details.

Home Page:https://js-kongress.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[webpack team proposal] Is it a good idea to overload require()/import?

jhnns opened this issue · comments

Session Title:
Is it a good idea to overload require()/import?

Session Abstract:
Webpack allows to overload the require() or import mechanism in order to load different file types. For instance, in webpack applications it is quite common to require() an image or a CSS file. The result of the import statement is determined by an external configuration (in webpack land by loaders). For instance, CSS files are translated into an object of CSS class names which makes it easier and safer to reference class names from JavaScript. Images are usually translated to a string that represents a URL. This can be useful if the application wants to leverage HTTP long-term caching via hashed filenames.

There has been a long discussion with members from the browserify community whether this is a good idea or not (webpack/webpack#378). The biggest argument against it is that this feature is currently proprietary to webpack and that there is no standard for configuration and consumption. With the upcoming WHATWG loader specification, however, things might change.

Approximate Duration:
30 minutes

Your Name:
Johannes Ewald

Your Twitter handle:
jhnnns

Requirements:

[x] No
[ ] Yes => Please share what do you need.

Complexity:

[ ] Advanced
[x] Intermediate
[ ] Beginner