-
Notifications
You must be signed in to change notification settings - Fork 189
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
结合babelify使用的时候,runtime.js会报错 #112
Comments
你是绿箭?这个项目两年没有维护了,不建议使用在正式项目中… |
模板可以考虑采用基于 webpack 的方案 |
@aui 这个项目目前么有人维护了吗? |
暂时可以用 var String = this.String;
// 修改为:
var String = window.String;
gulp.task('tpl', function() {
gulp
.src('src/template/**/*.html')
.pipe(
tmodjs({
templateBase: 'src/template',
runtime: 'htmlTpl.js',
compress: false
})
)
// 主要是this → window
.pipe(replace('var String = this.String;', 'var String = window.String;'))
.pipe(gulp.dest('src/js'));
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
结合 babelify 使用的时候,babelify 会重新编译代码,导致 runtime.js 的
this
指向undefined
:建议改成:
The text was updated successfully, but these errors were encountered: