久久久久久久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ù)?的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                問題描述

                限時(shí)送ChatGPT賬號..

                當(dāng)我運(yùn)行 gulp 時(shí),我收到以下錯(cuò)誤:

                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 語法來糾正縮小錯(cuò)誤:

                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,并在您縮小時(shí)生成廣泛支持的純"javascript.

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

                可能需要注意 - 正如評論中所指出的 - 核心 babel 編譯器作為 對等依賴 在這個(gè)插件中.如果核心庫沒有通過您的存儲庫中的另一個(gè) 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) 也可以使用.我的猜測是作者(這兩個(gè)項(xiàng)目都是一樣的)正在重新組織他們的模塊命名.無論哪種方式,兩個(gè) npm 安裝端點(diǎn)都指向 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 - 傳播運(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ù))
                Visual Studio 2015 crashes when opening Javascript files(打開 Javascript 文件時(shí) 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免费在线看 | 天天综合网91 | 成人av网页 | 毛片网在线观看 | 91porn在线观看| 国产福利视频网站 | 国产欧美日韩一区二区三区在线观看 | 天天影视亚洲综合网 | 国产一区2区 | 国产一区二区三区免费 | 可以免费观看的av片 | 欧美色影院 | 欧美精 | 欧美日韩成人一区二区 | 亚洲激情在线 | 国产精品成人一区二区三区吃奶 | 天天操天天拍 | 久草欧美视频 | 在线视频 亚洲 | 欧美日韩国产高清视频 | 国产色婷婷精品综合在线播放 | 亚洲欧美日韩精品久久亚洲区 | 中文字幕亚洲精品 | 日韩免费一区二区 | 一区二区高清 | 国产成人精品一区二区 | 日韩中文字幕在线观看 | 狠狠操网站 | 国产精品a久久久久 | 日韩中文欧美 | 欧美视频在线看 | 国产精品视频一二三区 | 欧美一区免费 | 青青草在线播放 | 欧美久久久久久 | 欧美激情在线精品一区二区三区 | 色播av| 9191在线观看 | 日韩三区 | 精品欧美一区二区三区久久久 |