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

      • <bdo id='3APOC'></bdo><ul id='3APOC'></ul>

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

        <small id='3APOC'></small><noframes id='3APOC'>

        <legend id='3APOC'><style id='3APOC'><dir id='3APOC'><q id='3APOC'></q></dir></style></legend><tfoot id='3APOC'></tfoot>

      1. UglifyJS 拋出意外的標記:keyword (const) with node_modu

        UglifyJS throws unexpected token: keyword (const) with node_modules(UglifyJS 拋出意外的標記:keyword (const) with node_modules)
        <legend id='gLbjQ'><style id='gLbjQ'><dir id='gLbjQ'><q id='gLbjQ'></q></dir></style></legend>

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

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

            <tfoot id='gLbjQ'></tfoot>

                  <tbody id='gLbjQ'></tbody>
                • <bdo id='gLbjQ'></bdo><ul id='gLbjQ'></ul>
                  本文介紹了UglifyJS 拋出意外的標記:keyword (const) with node_modules的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  我開始的一個小項目使用聲明 const 變量的節點模塊(通過 npm 安裝).運行測試這個項目很好,但是執行UglifyJS時browserify失敗了.

                  A small project I started make use a node module (installed via npm) that declares const variables. Running and testing this project is well, but browserify fails when UglifyJS is executed.

                  意外標記:關鍵字(const)

                  Unexpected token: keyword (const)

                  這是一個通用的 Gulp 文件,我已經成功地將它用于過去的一些其他項目而沒有這個問題(即沒有那個特定的節點模塊).

                  Here is a generic Gulp file that I have successfully been using for a few other past projects without this issue (i.e. without that particular node module).

                  'use strict';
                  
                  const browserify = require('browserify');
                  const gulp = require('gulp');
                  const source = require('vinyl-source-stream');
                  const derequire = require('gulp-derequire');
                  const buffer = require('vinyl-buffer');
                  const uglify = require('gulp-uglify');
                  const sourcemaps = require('gulp-sourcemaps');
                  const gutil = require('gulp-util');
                  const path = require('path');
                  const pkg = require('./package');
                  const upperCamelCase = require('uppercamelcase');
                  
                  const SRC_PATH = path.dirname(pkg.main);
                  const DIST_PATH = path.dirname(pkg.browser);
                  
                  const INPUT_FILE = path.basename(pkg.main);
                  const OUTPUT_FILE = path.basename(pkg.browser);
                  
                  const MODULE_NAME = upperCamelCase(pkg.name);
                  
                  
                  gulp.task('default', () => {
                    // set up the browserify instance on a task basis
                    var b = browserify({
                      entries: INPUT_FILE,
                      basedir: SRC_PATH,
                      transform: ['babelify'],
                      standalone: MODULE_NAME,
                      debug: true
                    });
                  
                    return b.bundle()
                      .pipe(source(OUTPUT_FILE))
                      .pipe(buffer())
                      .pipe(derequire())
                      .pipe(sourcemaps.init({loadMaps: true}))
                      .pipe(uglify())
                      .on('error', gutil.log)
                      .pipe(sourcemaps.write('.'))
                      .pipe(gulp.dest(DIST_PATH))
                    ;
                  });
                  

                  我已嘗試通過將 npm 安裝的模塊中的所有 const 替換為 var 來解決此問題,一切都很好.所以我不理解失敗.

                  I have tried fixing this by replace all const to var in that npm-installed module, and everything is fine. So I do not understand the failure.

                  const 有什么問題?除非有人使用 IE10,否則所有主流瀏覽器都支持這種語法.

                  What's wrong with const? Unless someone uses IE10, all major browsers support this syntax.

                  有沒有辦法解決這個問題而無需更改該節點模塊?

                  Is there a way to fix this without requiring a change to that node module?

                  我已經暫時(或永久)用 Butternut 替換了 UglifyJS,并且似乎可以工作.

                  I have temporarily (or permanently) replaced UglifyJS with Butternut and seem to work.

                  推薦答案

                  由于ChrisR 提到,UglifyJS 不支持 ES6完全沒有.

                  As ChrisR mentionned, UglifyJS does not support ES6 at all.

                  ES6 需要使用 terser-webpack-plugin (webpack@5會使用這個插件進行丑化)

                  You need to use terser-webpack-plugin for ES6 (webpack@5 will use this plugin for uglification)

                  npm install terser-webpack-plugin --save-dev
                  

                  然后在你的 plugins 數組中定義

                  Then define in your plugins array

                  const TerserPlugin = require('terser-webpack-plugin')
                  
                    new TerserPlugin({
                      parallel: true,
                      terserOptions: {
                        ecma: 6,
                      },
                    }),
                  

                  來源

                  這篇關于UglifyJS 拋出意外的標記:keyword (const) with node_modules的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  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 以使其以不同的方式運行任務?)
                  Why do we need to install gulp globally and locally?(為什么我們需要在全局和本地安裝 gulp?)
                  How to run Gulp tasks sequentially one after the other(如何一個接一個地依次運行 Gulp 任務)
                  Stylesheet not loaded because of MIME-type(由于 MIME 類型而未加載樣式表)
                  Visual Studio 2015 crashes when opening Javascript files(打開 Javascript 文件時 Visual Studio 2015 崩潰)
                    • <bdo id='QZcRk'></bdo><ul id='QZcRk'></ul>
                        <i id='QZcRk'><tr id='QZcRk'><dt id='QZcRk'><q id='QZcRk'><span id='QZcRk'><b id='QZcRk'><form id='QZcRk'><ins id='QZcRk'></ins><ul id='QZcRk'></ul><sub id='QZcRk'></sub></form><legend id='QZcRk'></legend><bdo id='QZcRk'><pre id='QZcRk'><center id='QZcRk'></center></pre></bdo></b><th id='QZcRk'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='QZcRk'><tfoot id='QZcRk'></tfoot><dl id='QZcRk'><fieldset id='QZcRk'></fieldset></dl></div>

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

                        • <legend id='QZcRk'><style id='QZcRk'><dir id='QZcRk'><q id='QZcRk'></q></dir></style></legend>

                            <tfoot id='QZcRk'></tfoot>
                              <tbody id='QZcRk'></tbody>

                            主站蜘蛛池模板: 97久久精品午夜一区二区 | 日韩亚洲一区二区 | 亚洲视频在线播放 | 日韩成人中文字幕 | 亚洲精品美女 | 国产精品久久777777 | 免费在线观看毛片 | 国产精品视频在线播放 | 成年人免费在线视频 | 精品欧美一区二区久久久伦 | 欧美二区乱c黑人 | 在线亚州| 天堂一区二区三区 | www在线视频| 丝袜 亚洲 另类 欧美 综合 | 91精品国产一区二区三区 | 性高朝久久久久久久3小时 av一区二区三区四区 | 日日操夜夜操天天操 | 在线四虎| 国产伦精品一区二区三区高清 | 精品三级在线观看 | 免费永久av | 免费高潮视频95在线观看网站 | 亚洲午夜精品久久久久久app | 色综合久久久久 | 国产午夜在线 | 亚洲一二三区精品 | 人人擦人人 | 日韩视频一区二区 | 嫩草懂你的影院入口 | 国产人久久人人人人爽 | a级毛片基地| 欧美一级www片免费观看 | 国产精品视频免费播放 | 亚洲国产成人精品在线 | 日本精品视频在线观看 | 一区二区三区在线免费观看 | 美女一区| 久久免费精品视频 | 欧美成人激情视频 | 国产91色在线 | 亚洲 |