I haven’t found much specific usage of es6 require. Most of them are briefly introduced to load modules, such as
const es_namespace = require('./es');
But I have seen this use of resolve elsewhere. => require(['../pages/login/'], resolve), what does this require function mean? Is there any official documentation? Or go into details?
ES6 modularization uses import and export. For details, you can see "Understanding ECMAScript6" https://sagittarius-rev.gitbo...,
Chapter 13 of this book uses modules to encapsulate code. I think it is very well written. , very clear and concise.
The require you are talking about is a js library RequireJS,
Chinese document http://www.requirejs.cn/,
This tutorial is also good http://www.runoob.com/w3cnote...
Because
require
是require.js
is a library, you can take a look at Ruan Yifeng’s introduction on how to use require.jsThis is how require works.
['../pages/login/'] may load all files under "../pages/login/"
You can refer to require() source code interpretation