-1
我有加載模塊index.html
爲:要求JS不是從CONFIGS
<!DOCTYPE html>
<html>
<head>
<script data-main="scripts/main" src="lib/require.js"></script>
</head>
<body>
<h1>Example 1: basic usage</h1>
</body>
</html>
和main.js
:
requirejs.config({
waitSeconds: 200,
paths: {
"app": "app"
}
});
和app.js
:
define(function() {
alert('Hello World');
});
兩個main
和app
都在之下文件夾。
當我打開index.html
,並在控制檯,如果我給:
require("app")
我得到這樣的錯誤:
Uncaught Error: Module name "app" has not been loaded yet for context: _. Use require([])
不知道,在那裏我已經錯了。