Npm run build error "UglifyJs Unexpected token: name (dt)"

< H2 > configuration is as follows: < / H2 >

webpack.base.config.js

const path = require("path");
const os = require("os");
const webpack = require("webpack");
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const HappyPack = require("happypack");
var happyThreadPool = HappyPack.ThreadPool({ size: os.cpus().length });
function resolve (dir) {
    return path.join(__dirname, dir);
}
module.exports = {
    entry: {
        main: "@/main",
        "vender-base": "@/vendors/vendors.base.js",
        "vender-exten": "@/vendors/vendors.exten.js"
    },
    output: {
        path: path.resolve(__dirname, "../dist/dist")
    },
    module: {
        rules: [
            {
                test: /\.vue$/,
                loader: "vue-loader",
                options: {
                    loaders: {
                        css: "vue-style-loader!css-loader",
                        less: "vue-style-loader!css-loader!less-loader"
                    },
                    postLoaders: {
                        html: "babel-loader"
                    }
                }
            },
            {
                test: /iview\/.*?js$/,
                loader: "happypack/loader?id=happybabel",
                exclude: /node_modules/
            },
            {
                test: /\.js$/,
                loader: "happypack/loader?id=happybabel",
                exclude: /node_modules/
            },
            {
                test: /\.js[x]?$/,
                include: [resolve("src")],
                exclude: /node_modules/,
                loader: "happypack/loader?id=happybabel"
            },
            {
                test: /\.css$/,
                use: ExtractTextPlugin.extract({
                    use: ["css-loader?minimize", "autoprefixer-loader"],
                    fallback: "style-loader"
                })
            },
            {
                test: /\.less$/,
                use: ExtractTextPlugin.extract({
                    use: ["css-loader?minimize","autoprefixer-loader", "less-loader"],
                    fallback: "style-loader"
                }),
            },
            {
                test: /\.(gif|jpg|png|woff|svg|eot|ttf)\??.*$/,
                loader: "url-loader?limit=1024"
            },
            {
                test: /\.(html|tpl)$/,
                loader: "html-loader"
            }
        ]
    },
    plugins: [
        new HappyPack({
            id: "happybabel",
            loaders: ["babel-loader"],
            threadPool: happyThreadPool,
            verbose: true
        })
    ],
    resolve: {
        extensions: [".js", ".vue"],
        alias: {
            "vue": "vue/dist/vue.esm.js",
            "@": resolve("../src"),
        }
    }
};

webpack.prod.config.js

const webpack = require("webpack");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const CopyWebpackPlugin = require("copy-webpack-plugin");
const cleanWebpackPlugin = require("clean-webpack-plugin");
const UglifyJsParallelPlugin = require("webpack-uglify-parallel");
const merge = require("webpack-merge");
const webpackBaseConfig = require("./webpack.base.config.js");
const os = require("os");
const fs = require("fs");
const path = require("path");
const package = require("../package.json");

fs.open("./build/env.js", "w", function(err, fd) {
    const buf = "export default "production";";
    fs.write(fd, buf, 0, buf.length, 0, function(err, written, buffer) {});
});

module.exports = merge(webpackBaseConfig, {
    output: {
        publicPath: "./",  //  https://iv...admin  
        filename: "[name].[hash].js",
        chunkFilename: "[name].[hash].chunk.js"
    },
    plugins: [
        new cleanWebpackPlugin(["dist/*"], {
            root: path.resolve(__dirname, "../")
        }),
        new ExtractTextPlugin({
            filename: "[name].[hash].css",
            allChunks: true
        }),
        new webpack.optimize.CommonsChunkPlugin({
            // name: "vendors",
            // filename: "vendors.[hash].js"
            name: ["vender-exten", "vender-base"],
            minChunks: Infinity
        }),
        new webpack.DefinePlugin({
            "process.env": {
                NODE_ENV: ""production""
            }
        }),
        new webpack.optimize.UglifyJsPlugin({
            compress: {
                warnings: false
            }
        }),
        new HtmlWebpackPlugin({
            title: "Watch Dog" + package.version,
            favicon: "./ico.png",
            filename: "../index.html",
            template: "!!ejs-loader!./src/template/index.ejs",
            inject: false
        })
    ]
});

debug.log

0 info it worked if it ends with ok
1 verbose cli [ "D:\\softs\\nodejs\\node.exe",
1 verbose cli   "D:\\softs\\nodejs\\node_modules\\npm\\bin\\npm-cli.js",
1 verbose cli   "run",
1 verbose cli   "build" ]
2 info using npm@5.6.0
3 info using node@v8.11.1
4 verbose run-script [ "prebuild", "build", "postbuild" ]
5 info lifecycle watch-dog@1.0.0~prebuild: watch-dog@1.0.0
6 info lifecycle watch-dog@1.0.0~build: watch-dog@1.0.0
7 verbose lifecycle watch-dog@1.0.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle watch-dog@1.0.0~build: PATH: D:\softs\nvm\v8.11.1\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;E:\dev\vue\watchDog-framework-web\node_modules\.bin;D:\softs\Python\Python35\Scripts\;D:\softs\Python\Python35\;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Common Files\Intel\Shared Files\cpp\bin\Intel64;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\MinGW\bin;E:\lua5.3;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;D:\softs\Git\cmd;D:\softs\TortoiseGit\bin;D:\softs\apache-maven-3.5.2\bin;D:\softs\nvm;D:\softs\nodejs;D:\softs\MongoDB\Server\3.6\bin;C:\Users\Administrator\AppData\Local\Yarn\bin;D:\softs\Redis\;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;D:\softs\Microsoft VS Code\bin;D:\softs\nvm;D:\softs\nodejs
9 verbose lifecycle watch-dog@1.0.0~build: CWD: E:\dev\vue\watchDog-framework-web
10 silly lifecycle watch-dog@1.0.0~build: Args: [ "/d /s /c",
10 silly lifecycle   "webpack --progress --hide-modules --config build/webpack.prod.config.js" ]
11 silly lifecycle watch-dog@1.0.0~build: Returned: code: 2  signal: null
12 info lifecycle watch-dog@1.0.0~build: Failed to exec build script
13 verbose stack Error: watch-dog@1.0.0 build: `webpack --progress --hide-modules --config build/webpack.prod.config.js`
13 verbose stack Exit status 2
13 verbose stack     at EventEmitter.<anonymous> (D:\softs\nvm\v8.11.1\node_modules\npm\node_modules\npm-lifecycle\index.js:285:16)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at EventEmitter.emit (events.js:214:7)
13 verbose stack     at ChildProcess.<anonymous> (D:\softs\nvm\v8.11.1\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at ChildProcess.emit (events.js:214:7)
13 verbose stack     at maybeClose (internal/child_process.js:925:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid watch-dog@1.0.0
15 verbose cwd E:\dev\vue\watchDog-framework-web
16 verbose Windows_NT 10.0.14393
17 verbose argv "D:\\softs\\nodejs\\node.exe" "D:\\softs\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
18 verbose node v8.11.1
19 verbose npm  v5.6.0
20 error code ELIFECYCLE
21 error errno 2
22 error watch-dog@1.0.0 build: `webpack --progress --hide-modules --config build/webpack.prod.config.js`
22 error Exit status 2
23 error Failed at the watch-dog@1.0.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]

console error:

ERROR in 1.2a66533fcf6762182963.chunk.js from UglifyJs
Unexpected token: name (dt) [1.2a66533fcf6762182963.chunk.js:3397,6]

ERROR in 3.2a66533fcf6762182963.chunk.js from UglifyJs
Unexpected token: name (dt) [3.2a66533fcf6762182963.chunk.js:3397,6]
Child html-webpack-plugin for "..\index.html":
     1 asset
Child extract-text-webpack-plugin node_modules/extract-text-webpack-plugin/dist node_modules/css-loader/index.js?minimize!node_modules/autoprefixer-loader/index.js!node_modules/iview/dist/styles/iview.css:
                                    Asset     Size  Chunks                    Chunk Names
     2c2ae068be3b089e0a5b59abb1831550.eot   121 kB          [emitted]
     24712f6c47821394fba7942fbb52c3b2.ttf   189 kB          [emitted]
    05acfdb568b3df49ad31355b19495d4a.woff  67.9 kB          [emitted]
     621bd386841f74e0053cb8e67f8a0604.svg   334 kB          [emitted]  [big]
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! watch-dog@1.0.0 build: `webpack --progress --hide-modules --config build/webpack.prod.config.js`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the watch-dog@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2018-04-26T05_14_33_877Z-debug.log

seek a solution


remove Miment > timebase dependency from the project . The specific reason is unknown


stepped on this hole all day, and finally popped out. According to the directory where your webpack.base.config.js is located, the corresponding include needs the path of babel when packing, and the path must be correct, and include and exclude cannot be shared, or cannot be used in the same directory at the same time.
follow normal logic. Files in node_modules should not contain es6 code to
{

test: /\.js$/,
loader: 'happypack/loader?id=happybabel',
include: [resolve('../build'), resolve('../src'), resolve('../node_modules/iview/src'), resolve('../node_modules/iview/dist')]

}

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b32727-2b590.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b32727-2b590.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?