Reputation: 1495
Would I be correct in saying that if you don't have webpack, require
will just place the required file into another file? Whereas with webpack, it can go through transformations and loaders before being placed into the file that is requiring it?
Upvotes: 0
Views: 47
Reputation: 2118
These are different concepts:
Modules
Historically were introduced different Module Formats (AMD, CommonJS, UMD, …) and Module Loaders (RequireJS, SystemJS, …) where Module Format means syntax and Module Loader means execution or implementation. There are lots of JS projects developed using different approaches. Even ES2015 (ES6) has its own module format. Anyways, this post isn´t about modules in JS, so let´s say that we have two different approaches to load modules to the browsers:
Module Loaders.
Load the required JS Modules as a different files using JavaScript at execution time.
Bundlers.
Package all the solution in one bundle.js file which contains all your application modules. Browserify, WebPack.
More information> https://blog.josequinto.com/2016/11/14/how-to-build-a-new-spa-with-es6-scss-react-webpack-and-hmr-the-beginners-guide/
Upvotes: 1