Closed zhengmz closed 4 years ago
使用最新的版本: esl@2.2.2-beta.1
index.html文件内容:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Test</title> </head> <body> <script src="node_modules/esljs/dist/esl.js" data-main="index"></script> </body> </html
require.config({ baseUrl: './src', paths: { san: '../node_modules/san/dist/san.dev', 'san-router': '../node_modules/san-router/dist/san-router.source' }, waitSeconds: 5 }); require(['main'], function (main) { //此处为报错点 main.start(); });
define(function(require) { return { start: function () { console.log('application start...'); } }; })
[MODULE_TIMEOUT]Hang: none; Miss: index
但实际已经加载进来,也能正常打印日志。
我猜因为index.js不是一个标准模块,所以出现错误,不知道是不是? @errorrik
为此,我尝试在index.js增加了一个空白的模块定义:
define(function(require) { 'use strict'; return {}; })
就不再提示错误。
使用define来定义data-main模块,就可以了。
一、使用过程
使用最新的版本: esl@2.2.2-beta.1
index.html文件内容:
二、出错信息
[MODULE_TIMEOUT]Hang: none; Miss: index
但实际已经加载进来,也能正常打印日志。
三、两种临时补救
四、在requirejs中表现是正常的