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

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

      • <bdo id='cuPwe'></bdo><ul id='cuPwe'></ul>

    1. <small id='cuPwe'></small><noframes id='cuPwe'>

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

      如何使用 gulp-uglify 縮小 ES6 函數(shù)?

      How to minify ES6 functions with gulp-uglify?(如何使用 gulp-uglify 縮小 ES6 函數(shù)?)

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

        <tbody id='ArPAI'></tbody>

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

            <bdo id='ArPAI'></bdo><ul id='ArPAI'></ul>
            <tfoot id='ArPAI'></tfoot>
            1. <legend id='ArPAI'><style id='ArPAI'><dir id='ArPAI'><q id='ArPAI'></q></dir></style></legend>
                本文介紹了如何使用 gulp-uglify 縮小 ES6 函數(shù)?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                限時送ChatGPT賬號..

                當我運行 gulp 時,我收到以下錯誤:

                When I run gulp I get the following error:

                [12:54:14] { [GulpUglifyError: unable to minify JavaScript]
                cause:
                { [SyntaxError: Unexpected token: operator (>)]
                 message: 'Unexpected token: operator (>)',
                 filename: 'bundle.js',
                 line: 3284,
                 col: 46,
                 pos: 126739 },
                plugin: 'gulp-uglify',
                fileName: 'C:\servers\vagrant\workspace\awesome\web\tool\bundle.js',
                showStack: false }
                

                違規(guī)行包含箭頭函數(shù):

                let zeroCount = numberArray.filter(v => v === 0).length
                

                我知道我可以將其替換為以下內(nèi)容,以通過放棄 ES6 語法來糾正縮小錯誤:

                I know I can replace it with the following to remedy the minification error by abandoning ES6 syntax:

                let zeroCount = numberArray.filter(function(v) {return v === 0;}).length
                

                如何通過 gulp 縮小包含 ES6 功能的代碼?

                How can I minify code containing ES6 features via gulp?

                推薦答案

                你可以利用 gulp-babel 這樣……

                You can leverage gulp-babel as such...

                const gulp = require('gulp');
                const babel = require('gulp-babel');
                const uglify = require('gulp-uglify');
                
                gulp.task('minify', () => {
                  return gulp.src('src/**/*.js')
                    .pipe(babel({
                      presets: ['es2015']
                    }))
                    .pipe(uglify())
                    // [...]
                });
                

                這將在管道的早期轉(zhuǎn)譯您的 es6,并在您縮小時生成廣泛支持的純"javascript.

                This will transpile your es6 early in the pipeline and churn out as widely supported "plain" javascript by the time you minify.

                可能需要注意 - 正如評論中所指出的 - 核心 babel 編譯器作為 對等依賴 在這個插件中.如果核心庫沒有通過您的存儲庫中的另一個 dep 被拉下,請確保將其安裝在您的最后.

                May be important to note - as pointed out in comments - the core babel compiler ships as a peer dependency in this plugin. In case the core lib is not being pulled down via another dep in your repo, ensure this is installed on your end.

                查看gulp-babel 作者指定 @babel/core (7.X).不過,稍舊的 babel-core (6.x) 也可以使用.我的猜測是作者(這兩個項目都是一樣的)正在重新組織他們的模塊命名.無論哪種方式,兩個 npm 安裝端點都指向 https://github.com/babel/babel/tree/master/packages/babel-core,所以你可以使用以下任何一種......

                Looking at the peer dependency in gulp-babel the author is specifying @babel/core (7.x). Though, the slightly older babel-core (6.x) will work as well. My guess is the author (who is the same for both projects) is in the midsts of reorganizing their module naming. Either way, both npm installation endpoints point to https://github.com/babel/babel/tree/master/packages/babel-core, so you'll be fine with either of the following...

                npm install babel-core --save-dev
                

                npm install @babel/core --save-dev
                

                這篇關(guān)于如何使用 gulp-uglify 縮小 ES6 函數(shù)?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                相關(guān)文檔推薦

                Browserify, Babel 6, Gulp - Unexpected token on spread operator(Browserify,Babel 6,Gulp - 傳播運算符上的意外令牌)
                Is it possible to pass a flag to Gulp to have it run tasks in different ways?(是否可以將標志傳遞給 Gulp 以使其以不同的方式運行任務(wù)?)
                Why do we need to install gulp globally and locally?(為什么我們需要在全局和本地安裝 gulp?)
                How to run Gulp tasks sequentially one after the other(如何一個接一個地依次運行 Gulp 任務(wù))
                Visual Studio 2015 crashes when opening Javascript files(打開 Javascript 文件時 Visual Studio 2015 崩潰)
                Detect FLASH plugin crashes(檢測 FLASH 插件崩潰)

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

                <tfoot id='gCQYU'></tfoot>

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

                    • <bdo id='gCQYU'></bdo><ul id='gCQYU'></ul>
                      <legend id='gCQYU'><style id='gCQYU'><dir id='gCQYU'><q id='gCQYU'></q></dir></style></legend>
                          主站蜘蛛池模板: 国产视频三区 | 欧美福利一区 | 日韩精品一区二区三区免费视频 | 国产乱码精品一区二区三区五月婷 | 一级免费在线视频 | 国产 91 视频 | 在线欧美视频 | 国产黄视频在线播放 | 久久手机视频 | 亚洲精品乱码久久久久久按摩 | 亚欧精品一区 | 国产精品成人久久久久 | 亚洲在线免费观看 | 久久y| 精品免费av| av一区二区三区四区 | 日本不卡免费新一二三区 | 成人在线视频观看 | 日韩毛片在线视频 | 欧美亚洲成人网 | 国产视频一视频二 | 91精品国产91久久久久久三级 | 久久中文免费视频 | 色综合中文 | 国产免费自拍 | 成人免费视频网站在线看 | 美女二区 | 日韩激情一区 | 91精品国产乱码久久久久久久久 | 国产真实乱对白精彩久久小说 | 久久久久精| 亚洲一区在线播放 | 亚洲国产情侣 | 欧美视频在线播放 | 亚洲福利| www.久久99 | 日韩国产在线观看 | 一级黄色夫妻生活 | 日韩欧美亚洲一区 | 国产美女一区二区 | 一区二区三区在线 |