久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <tfoot id='r3FHi'></tfoot>
      <bdo id='r3FHi'></bdo><ul id='r3FHi'></ul>

      <small id='r3FHi'></small><noframes id='r3FHi'>

      <legend id='r3FHi'><style id='r3FHi'><dir id='r3FHi'><q id='r3FHi'></q></dir></style></legend>

    1. <i id='r3FHi'><tr id='r3FHi'><dt id='r3FHi'><q id='r3FHi'><span id='r3FHi'><b id='r3FHi'><form id='r3FHi'><ins id='r3FHi'></ins><ul id='r3FHi'></ul><sub id='r3FHi'></sub></form><legend id='r3FHi'></legend><bdo id='r3FHi'><pre id='r3FHi'><center id='r3FHi'></center></pre></bdo></b><th id='r3FHi'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='r3FHi'><tfoot id='r3FHi'></tfoot><dl id='r3FHi'><fieldset id='r3FHi'></fieldset></dl></div>

        如何同時(shí)使用“gulp-babel"和“gulp-browserify&qu

        How to use both #39;gulp-babel#39; and #39;gulp-browserify#39;(如何同時(shí)使用“gulp-babel和“gulp-browserify)
          <bdo id='pR0Mm'></bdo><ul id='pR0Mm'></ul>
          1. <tfoot id='pR0Mm'></tfoot>

            • <small id='pR0Mm'></small><noframes id='pR0Mm'>

              • <i id='pR0Mm'><tr id='pR0Mm'><dt id='pR0Mm'><q id='pR0Mm'><span id='pR0Mm'><b id='pR0Mm'><form id='pR0Mm'><ins id='pR0Mm'></ins><ul id='pR0Mm'></ul><sub id='pR0Mm'></sub></form><legend id='pR0Mm'></legend><bdo id='pR0Mm'><pre id='pR0Mm'><center id='pR0Mm'></center></pre></bdo></b><th id='pR0Mm'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='pR0Mm'><tfoot id='pR0Mm'></tfoot><dl id='pR0Mm'><fieldset id='pR0Mm'></fieldset></dl></div>
                <legend id='pR0Mm'><style id='pR0Mm'><dir id='pR0Mm'><q id='pR0Mm'></q></dir></style></legend>

                    <tbody id='pR0Mm'></tbody>
                  本文介紹了如何同時(shí)使用“gulp-babel"和“gulp-browserify"的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  限時(shí)送ChatGPT賬號(hào)..

                  我嘗試編寫這些代碼

                   gulp.task('script', function() {
                    'use strict'
                    return gulp.src(['app.js', 'components/**/*.jsx'])
                      .pipe(babel())
                      .pipe(browserify())
                      .pipe(gulp.dest("dist"));
                  });
                  

                  但它顯示了一些錯(cuò)誤:

                  SyntaxError: 
                  /Users/Zizy/Programming/learn-react-js/components/CommentBox.jsx:58
                      <div className="commentBox">
                      ^
                  ParseError: Unexpected token
                      at wrapWithPluginError (/Users/Zizy/Programming/learn-react-js/node_modules/gulp-browserify/index.js:44:10)
                  

                  似乎在 .pipe(browserify()) 之前 gulp 沒有轉(zhuǎn)換 jsx 代碼.但是如果我只是刪除 .pipe(browserify()) 我發(fā)現(xiàn)確實(shí)轉(zhuǎn)換了,就不能讓 babel 和 browserify 一起工作.

                  It seems that before .pipe(browserify()) the gulp did't transform the jsx code. But if I just remove .pipe(browserify()) I find that did transform, just cannot let babel and browserify work together.

                  我知道也許我可以使用 babelifybrowserify plugin for babel 之類的東西,但我只是想弄清楚原因.

                  I know maybe I can use like babelify or browserify plugin for babel though, I?just want figure out the reason.

                  推薦答案

                  gulp-browserify 并不是這樣工作的.你不會(huì)給它一堆緩沖區(qū)來收集和捆綁.

                  gulp-browserify doesn't quite work like that. You don't give it a bunch of buffers to collect and bundle.

                  你給它一個(gè)文件——入口文件——它傳遞給 Browserify.Browserify 會(huì)檢查條目文件引用的 other 文件,然后直接從文件系統(tǒng)加載這些文件,這意味著您不能事先使用 gulp 插件修改它們.

                  You give it one file—the entry file—which it passes into Browserify. Browserify checks to see what other files the entry file references, then loads those files directly from the file system, meaning that you can't modify them with gulp plugins beforehand.

                  所以,真的,如果我們假裝你不想在你的源文件上使用 Babel,你的 gulpfile 應(yīng)該是這樣的,只傳入入口文件:

                  So, really, if we pretend you don't want to use Babel on your source files, your gulpfile should look like this, only passing in the entry file:

                   gulp.task('script', function() {
                    'use strict'
                    return gulp.src('app.js')
                      .pipe(browserify())
                      .pipe(gulp.dest("dist"));
                  });
                  

                  但是,請(qǐng)注意 gulp-browserify 不再維護(hù),這正是原因.gulp 插件不應(yīng)該直接從文件系統(tǒng)中讀取.這就是為什么你應(yīng)該直接使用 Browserify(或者,在你的情況下,Babelify)與vinyl-source-stream 按照 gulp 配方中的建議.它更慣用,更不容易混淆.

                  However, note that gulp-browserify is no longer maintained, and this is exactly why. gulp plugins aren't supposed to read directly from the file system. That's why you're supposed to use Browserify (or, in your case, Babelify) directly with vinyl-source-stream as recommended in the gulp recipes. It's more idiomatic and less confusing.

                  這就是我對(duì)您問題的回答,但我想補(bǔ)充一點(diǎn):如果您使用的是 ES2015 模塊語法(您可能應(yīng)該使用),那么有更好的方法來做到這一點(diǎn).Browserify 將所有模塊單獨(dú)包裝在一堆代碼中,以使編程的 CommonJS API 正常工作,但是 ES2015 模塊具有聲明性語法,這使得工具更容易靜態(tài)地對(duì)其進(jìn)行操作.有一個(gè)名為 Rollup 的工具利用了這一點(diǎn),允許它生成比 Browserify 的更小、更快、更適合小型化的包.

                  That wraps up my answer to your question, but I'd like to add: if you're using the ES2015 module syntax (and you probably should be), there's a better way to do this. Browserify wraps all your modules separately in a bunch of code to make the programmatic CommonJS API work properly, but ES2015 modules have a declarative syntax, which makes it much easier for tools to operate on them statically. There's a tool called Rollup that takes advantage of this, allowing it to produce bundles that are smaller, faster, and more minfication-friendly than Browserify's.

                  下面是你可以如何使用它與 gulp:

                  Here's how you might use it with gulp:

                  var gulp = require('gulp'),
                      rollup = require('rollup-stream'),
                      babel = require('gulp-babel'),
                      source = require('vinyl-source-stream'),
                      buffer = require('vinyl-buffer');
                  
                  gulp.task('script', function() {
                    return rollup({entry: 'app.js'})
                      .pipe(source('app.js'))
                      .pipe(buffer())
                      .pipe(babel())
                      .pipe(gulp.dest('dist'));
                  });
                  

                  這篇關(guān)于如何同時(shí)使用“gulp-babel"和“gulp-browserify"的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  Browserify, Babel 6, Gulp - Unexpected token on spread operator(Browserify,Babel 6,Gulp - 傳播運(yùn)算符上的意外令牌)
                  Is it possible to pass a flag to Gulp to have it run tasks in different ways?(是否可以將標(biāo)志傳遞給 Gulp 以使其以不同的方式運(yùn)行任務(wù)?)
                  Why do we need to install gulp globally and locally?(為什么我們需要在全局和本地安裝 gulp?)
                  How to run Gulp tasks sequentially one after the other(如何一個(gè)接一個(gè)地依次運(yùn)行 Gulp 任務(wù))
                  Stylesheet not loaded because of MIME-type(由于 MIME 類型而未加載樣式表)
                  Visual Studio 2015 crashes when opening Javascript files(打開 Javascript 文件時(shí) Visual Studio 2015 崩潰)

                    <small id='xERGx'></small><noframes id='xERGx'>

                      <tbody id='xERGx'></tbody>
                    <legend id='xERGx'><style id='xERGx'><dir id='xERGx'><q id='xERGx'></q></dir></style></legend>
                        <bdo id='xERGx'></bdo><ul id='xERGx'></ul>
                      • <i id='xERGx'><tr id='xERGx'><dt id='xERGx'><q id='xERGx'><span id='xERGx'><b id='xERGx'><form id='xERGx'><ins id='xERGx'></ins><ul id='xERGx'></ul><sub id='xERGx'></sub></form><legend id='xERGx'></legend><bdo id='xERGx'><pre id='xERGx'><center id='xERGx'></center></pre></bdo></b><th id='xERGx'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='xERGx'><tfoot id='xERGx'></tfoot><dl id='xERGx'><fieldset id='xERGx'></fieldset></dl></div>
                        <tfoot id='xERGx'></tfoot>

                            主站蜘蛛池模板: 久久久www成人免费无遮挡大片 | 成人av鲁丝片一区二区小说 | 99re热精品视频 | 人人干超碰 | 亚洲视频手机在线 | 亚洲欧美精品在线观看 | 紧缚调教一区二区三区视频 | 久久久久久免费毛片精品 | 久久久久久久久久爱 | 97人人澡人人爽91综合色 | 亚洲国产成人精品女人久久久 | 日韩中文字幕在线观看 | 精品一区二区三区在线视频 | 日韩欧美中文在线 | 中文字幕视频在线 | 国产精品视频一区二区三区四区国 | 亚洲毛片在线观看 | 久久久久国产精品午夜一区 | 欧美精品1区2区3区 精品国产欧美一区二区 | 男人天堂网站 | 精品欧美视频 | 精品在线一区 | 国产人成精品一区二区三 | 在线91 | 欧美在线视频免费 | 在线观看亚洲精品 | 日日操操 | 精品久久中文字幕 | 黄色激情毛片 | 久久51| 午夜av毛片 | 成人久久久久 | 成年人在线观看视频 | 久久精品色欧美aⅴ一区二区 | 99在线免费观看 | 成人h动漫亚洲一区二区 | 国产一区二区三区在线免费观看 | 中文字幕一区在线 | 久久久久久久久久久丰满 | 91影视 | 一区二区三区视频免费观看 |