如何用JavaScript摆脱gulp文件中的严格使用
我需要删除所有“严格模式”。下面的代码运行没有错误,但我的“严格模式”;不改为如何用JavaScript摆脱gulp文件中的严格使用,gulp,Gulp,我需要删除所有“严格模式”。下面的代码运行没有错误,但我的“严格模式”;不改为 gulp.task('bundle', function () { var bundled = bundle(bundler()) if (!production) return bundled; return bundled .pipe(buffer()) .pipe(replace(/"use strict"'/g, ';')) // problem line .pipe(plugins.ugli
gulp.task('bundle', function () {
var bundled = bundle(bundler())
if (!production) return bundled;
return bundled
.pipe(buffer())
.pipe(replace(/"use strict"'/g, ';')) // problem line
.pipe(plugins.uglify())
.pipe(plugins.rename({
suffix: '.min'
}))
.pipe(gulp.dest('dist/app'));
});
看起来您的regexp中有一个松散的单引号
.pipe(replace(/"use strict"'/g, ';'))
here ----^
此regexp将匹配“使用严格”
和“使用严格”
看起来您的regexp中有一个松散的单引号
.pipe(replace(/"use strict"'/g, ';'))
here ----^
此regexp将匹配“使用严格”
和“使用严格”
这个想法对我使用Drupal7的聚合js文件选项很有用,因为第三方js在“UseStrict”下被打破了,所以谢谢你的帖子!这个想法对我使用Drupal7的聚合js文件选项很有用,因为第三方js在“UseStrict”下被打破了,所以谢谢你的帖子!