简体   繁体   English

Vueify 和 Babel 7

[英]Vueify and Babel 7

I am using Gulp, Browserify, Vueify and Babel to build my vue.js project.我正在使用 Gulp、Browserify、Vueify 和 Babel 来构建我的 vue.js 项目。 I cannot move to another building system, so Gulp it is.我无法移动到另一个建筑系统,所以 Gulp 是。 I recently updated from Babel 6 to Babel 7, due to a new addition in my project : Jest and unit testing (Babel 7 is a requirement)我最近从 Babel 6 更新到 Babel 7,因为我的项目中添加了一个新内容:Jest 和单元测试(Babel 7 是必需的)

Unfortunately, this had as a side effect Vueify to stop working with Babel 7, because it seems they are not compatible, or something.不幸的是,这有一个副作用 Vueify 停止与 Babel 7 一起工作,因为它们似乎不兼容,或者其他什么。 Npm Vueify package has not been updated for 2 years and I found a git issue that no-one has commented officially. npm Vueify 包已经2年没有更新了,我发现了一个没有人正式评论的git问题

Has anyone faced and resolved the same issue?有没有人遇到并解决过同样的问题? Any alternatives to Vueify? Vueify 的任何替代品? Thanks谢谢

You are right !你是对的 ! Vueify stopped maintaining their repository. Vueify 停止维护他们的存储库。 Although, I was able to use the following fork : "vueify":"github:stendahls/vueify#master" which adds support for Babel 7 and @babel/preset-env .虽然,我能够使用以下 fork : "vueify":"github:stendahls/vueify#master"它增加了对 Babel 7 和@babel/preset-env I will fork it myself but my tests were conclusive.我会自己分叉,但我的测试是决定性的。

Then, in my Gulpfile I could use the following :然后,在我的 Gulpfile 中,我可以使用以下内容

gulp.task('vueapp', () => {
    return browserify('assets/vueapp/js/main.js')
        .transform(vueify)
        .transform(babelify, {
            presets: ["@babel/preset-env"]
        })
        .bundle()
        .pipe(source('vueapp.js'))
        .pipe(gulp.dest('public/build/vueapp/js/'));
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM