Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

esl 与 requirejs 表现不一致的地方 #80

Open
MonchiLin opened this issue Sep 16, 2018 · 1 comment
Open

esl 与 requirejs 表现不一致的地方 #80

MonchiLin opened this issue Sep 16, 2018 · 1 comment

Comments

@MonchiLin
Copy link

MonchiLin commented Sep 16, 2018

目录结构

project\ (根目录)
            js\ ( js 目录 )
               lib\ ( 库目录 )
                    esl.js 
                    require.js
               main.js ( data-main 对应的 ) 
               app1.js ( app1.html 用的 )
            css\ 
            app1.html
app1.html 部分代码

注意: 如果这里使用 requirejs 则不会报错
使用 esl.js 会报 project/tweenmax.js net::ERR_FILE_NOT_FOUND

<script src="./js/lib/esl.js" data-main="js/main"></script>
<script>
    // 使用 requirejs 这里换成 require(['app1']);
    require(['js/app1']);
</script>
main.js 部分代码

require.config({
    baseUrl:'js',
    paths: {
        'tweenmax': './lib/tweenmax.min',

    },
    shim: {
        'tweenmax': {
            exports: 'TweenMax'
        }
    }
});

app1.js 部分代码
define(function (require) {
    var TweenMax = require("tweenmax")
    // var GSDevTools = require("GSDevTools")

})

如果描述不够请给我留言,使用 esl.js 有一段时间了,体积比 require.js 要小,不太想放弃,还请帮忙排查下,感觉应该是自己水平不够对路径转换理解比较浅造成的原因

@tanrich
Copy link

tanrich commented Oct 8, 2018

目录结构

project\ (根目录)
            js\ ( js 目录 )
               lib\ ( 库目录 )
                    esl.js 
                    require.js
               main.js ( data-main 对应的 ) 
               app1.js ( app1.html 用的 )
            css\ 
            app1.html
app1.html 部分代码

注意: 如果这里使用 requirejs 则不会报错
使用 esl.js 会报 project/tweenmax.js net::ERR_FILE_NOT_FOUND

<script src="./js/lib/esl.js" data-main="js/main"></script>
<script>
    // 使用 requirejs 这里换成 require(['app1']);
    require(['js/app1']);
</script>
main.js 部分代码

require.config({
    baseUrl:'js',
    paths: {
        'tweenmax': './lib/tweenmax.min',

    },
    shim: {
        'tweenmax': {
            exports: 'TweenMax'
        }
    }
});
app1.js 部分代码
define(function (require) {
    var TweenMax = require("tweenmax")
    // var GSDevTools = require("GSDevTools")

})

如果描述不够请给我留言,使用 esl.js 有一段时间了,体积比 require.js 要小,不太想放弃,还请帮忙排查下,感觉应该是自己水平不够对路径转换理解比较浅造成的原因

我在项目中没有遇到你这个问题。看报错就是路径的问题,都定位到 project 根目录下了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants