Multi-Module dependency
Just for the example, we just ran through the webpack through the Entry.js portal file for packaging. Let's take a look at whether it really supports the COMMONJS and AMD two modular mechanisms. Let's create a few more JS files!
Modify Module1.js
Require (["./module3"], function () { console.log ("Hello webpack!");});
Next file
Module2.js, using the COMMONJS mechanism to export the package
Module.exports = function (A, b) { return a + b;}
Next file
Module3.js, using the AMD module mechanism
define (['./module2.js '], function (sum) { return Console.log ("1 + 2 =" + SUM (1, 2));})
In fact, like the above mixed with two different mechanisms is very bad, here is only for display, in the development of new projects or recommended Commonjs or ES2015 module. Of course I personally prefer to ES2015 the module mechanism of ~
Multi-module dependency in Webpack