Webpack的构建速度非常慢

时间:2019-11-07 19:46:15

标签: webpack

我对使用和配置Webpack非常陌生。因此,到目前为止,我通过搜集我遇到的问题一直过得很好。现在,我挂了一个Webpack,等待构建,已经至少10分钟了,构建率只有39%!我的CPU和ram根本没有固定。

我正在使用Visual Studio2017。我创建了ASP.Net Core Web应用程序,然后选择“ React.js和Redux”。我必须安装几个缺少的npm依赖项。现在,当我执行仅运行“ webpack”的“ npm run build”时,大约需要16分钟! (在我写这篇文章的时候就结束了)

[webpack.Progress]构建977116ms

[webpack.Progress] 29毫秒大块资产处理

[webpack.Progress]密封后72毫秒

[webpack.Progress]发射91毫秒

这是我的webpack配置文件:

var path = require('path');
const HtmlWebPackPlugin = require("html-webpack-plugin");

module.exports = {
    context: path.join(__dirname, ''),
    entry: './src/index.js',
    output: {
        path: path.join(__dirname, 'dist'),
        filename: '[name].bundle.js'
    },
    mode: 'development',
    module: {
        rules: [
            {
                test: /\.html$/,
                use: [
                    {
                        loader: "html-loader",
                        options: { minimize: true }
                    }
                ]
            },
            { test: /\.js$/, use: 'ts-loader' }
        ]
    },
    plugins: [
        new HtmlWebPackPlugin({
            template: "./public/index.html",
            filename: "./index.html"
        })
    ],
    resolve: {
        extensions: ['.ts', '.tsx', '.js']
    },
};

package.json:

    {
  "name": "name",
  "version": "1.0.0",
  "description": "desc",
  "main": "index.js",
  "mode": "development",
  "dependencies": {
    "acorn": "^6.3.0",
    "ajv": "^6.10.2",
    "bootstrap": "^4.3.1",
    "browserify-zlib": "^0.2.0",
    "chrome-trace-event": "^1.0.2",
    "collection-visit": "^1.0.0",
    "cross-spawn": "^6.0.5",
    "cyclist": "^1.0.1",
    "debug": "^2.6.9",
    "decamelize": "^1.2.0",
    "decode-uri-component": "^0.2.0",
    "define-property": "^2.0.2",
    "des.js": "^1.0.0",
    "detect-file": "^1.0.0",
    "domain-browser": "^1.2.0",
    "emoji-regex": "^7.0.3",
    "end-of-stream": "^1.4.4",
    "errno": "^0.1.7",
    "escape-string-regexp": "^1.0.5",
    "eslint-scope": "^4.0.3",
    "esrecurse": "^4.2.1",
    "estraverse": "^4.3.0",
    "events": "^3.0.0",
    "evp_bytestokey": "^1.0.3",
    "execa": "^1.0.0",
    "expand-tilde": "^2.0.2",
    "fast-deep-equal": "^2.0.1",
    "fast-json-stable-stringify": "^2.0.0",
    "figgy-pudding": "^3.5.1",
    "fill-range": "^4.0.0",
    "find-up": "^3.0.0",
    "for-in": "^1.0.2",
    "fragment-cache": "^0.2.1",
    "fs.realpath": "^1.0.0",
    "fsevents": "^1.2.9",
    "get-caller-file": "^2.0.5",
    "get-stream": "^4.1.0",
    "get-value": "^2.0.6",
    "glob-parent": "^3.1.0",
    "global-modules": "^2.0.0",
    "global-prefix": "^1.0.2",
    "graceful-fs": "^4.2.3",
    "has-flag": "^3.0.0",
    "has-value": "^1.0.0",
    "has-values": "^1.0.0",
    "hash-base": "^3.0.4",
    "hash.js": "^1.1.7",
    "history": "^4.10.1",
    "hmac-drbg": "^1.0.1",
    "homedir-polyfill": "^1.0.3",
    "https-browserify": "^1.0.0",
    "ieee754": "^1.1.13",
    "iferr": "^0.1.5",
    "import-local": "^2.0.0",
    "imurmurhash": "^0.1.4",
    "infer-owner": "^1.0.4",
    "inflight": "^1.0.6",
    "ini": "^1.3.5",
    "interpret": "^1.2.0",
    "invert-kv": "^2.0.0",
    "is-accessor-descriptor": "^0.1.6",
    "is-buffer": "^1.1.6",
    "is-data-descriptor": "^0.1.4",
    "is-descriptor": "^0.1.6",
    "is-extendable": "^0.1.1",
    "is-extglob": "^2.1.1",
    "is-fullwidth-code-point": "^2.0.0",
    "is-glob": "^4.0.1",
    "is-number": "^3.0.0",
    "is-plain-object": "^2.0.4",
    "is-stream": "^1.1.0",
    "is-windows": "^1.0.2",
    "is-wsl": "^1.1.0",
    "isarray": "^1.0.0",
    "isexe": "^2.0.0",
    "isobject": "^3.0.1",
    "jquery": "^3.4.1",
    "json-parse-better-errors": "^1.0.2",
    "json-schema-traverse": "^0.4.1",
    "kind-of": "^6.0.2",
    "lcid": "^2.0.0",
    "loader-runner": "^2.4.0",
    "locate-path": "^3.0.0",
    "lru-cache": "^5.1.1",
    "make-dir": "^2.1.0",
    "mamacro": "^0.0.3",
    "map-age-cleaner": "^0.1.3",
    "map-cache": "^0.2.2",
    "map-visit": "^1.0.0",
    "md5.js": "^1.3.5",
    "mem": "^4.3.0",
    "mimic-fn": "^2.1.0",
    "minimalistic-assert": "^1.0.1",
    "minimalistic-crypto-utils": "^1.0.1",
    "mixin-deep": "^1.3.2",
    "mkdirp": "^0.5.1",
    "nan": "^2.14.0",
    "neo-async": "^2.6.1",
    "nice-try": "^1.0.5",
    "normalize-path": "^3.0.0",
    "npm-run-path": "^2.0.2",
    "object-visit": "^1.0.1",
    "object.pick": "^1.3.0",
    "once": "^1.4.0",
    "os-browserify": "^0.3.0",
    "os-locale": "^3.1.0",
    "p-defer": "^1.0.0",
    "p-finally": "^1.0.0",
    "p-is-promise": "^2.1.0",
    "p-limit": "^2.2.1",
    "p-locate": "^3.0.0",
    "p-try": "^2.2.0",
    "pako": "^1.0.10",
    "parse-passwd": "^1.0.0",
    "pascalcase": "^0.1.1",
    "path-browserify": "^0.0.1",
    "path-dirname": "^1.0.2",
    "path-exists": "^3.0.0",
    "path-is-absolute": "^1.0.1",
    "path-key": "^2.0.1",
    "pify": "^4.0.1",
    "pkg-dir": "^3.0.0",
    "popper.js": "^1.16.0",
    "posix-character-classes": "^0.1.1",
    "process": "^0.11.10",
    "process-nextick-args": "^2.0.1",
    "promise-inflight": "^1.0.1",
    "prr": "^1.0.1",
    "pump": "^3.0.0",
    "punycode": "^2.1.1",
    "querystring": "^0.2.0",
    "querystring-es3": "^0.2.1",
    "randombytes": "^2.1.0",
    "randomfill": "^1.0.4",
    "react": "^16.11.0",
    "react-bootstrap": "^1.0.0-beta.14",
    "react-dom": "^16.11.0",
    "react-redux": "^7.1.3",
    "react-router": "^5.1.2",
    "react-router-dom": "^5.1.2",
    "react-router-redux": "^4.0.8",
    "redux": "^4.0.4",
    "redux-thunk": "^2.3.0",
    "remove-trailing-separator": "^1.1.0",
    "repeat-element": "^1.1.3",
    "repeat-string": "^1.6.1",
    "require-directory": "^2.1.1",
    "require-main-filename": "^2.0.0",
    "resolve-cwd": "^2.0.0",
    "resolve-dir": "^1.0.1",
    "resolve-from": "^3.0.0",
    "resolve-url": "^0.2.1",
    "ret": "^0.1.15",
    "ripemd160": "^2.0.2",
    "safe-regex": "^1.1.0",
    "semver": "^5.7.1",
    "serialize-javascript": "^1.9.1",
    "set-blocking": "^2.0.0",
    "setimmediate": "^1.0.5",
    "sha.js": "^2.4.11",
    "shebang-command": "^1.2.0",
    "shebang-regex": "^1.0.0",
    "signal-exit": "^3.0.2",
    "snapdragon-node": "^2.1.1",
    "snapdragon-util": "^3.0.1",
    "source-list-map": "^2.0.1",
    "source-map-url": "^0.4.0",
    "ssri": "^6.0.1",
    "stream-each": "^1.2.3",
    "stream-shift": "^1.0.0",
    "string-width": "^3.1.0",
    "strip-eof": "^1.0.0",
    "supports-color": "^6.1.0",
    "timers-browserify": "^2.0.11",
    "to-arraybuffer": "^1.0.1",
    "to-object-path": "^0.3.0",
    "to-regex-range": "^2.1.1",
    "tslib": "^1.10.0",
    "tty-browserify": "^0.0.0",
    "typedarray": "^0.0.6",
    "typescript": "^3.7.2",
    "unique-filename": "^1.1.1",
    "unique-slug": "^2.0.2",
    "unset-value": "^1.0.0",
    "upath": "^1.2.0",
    "uri-js": "^4.2.2",
    "urix": "^0.1.0",
    "url": "^0.11.0",
    "use": "^3.1.1",
    "util": "^0.11.1",
    "vm-browserify": "^1.1.2",
    "webpack-sources": "^1.4.3",
    "which": "^1.3.1",
    "which-module": "^2.0.0",
    "worker-farm": "^1.7.0",
    "wrappy": "^1.0.2",
    "xtend": "^4.0.2",
    "y18n": "^4.0.0",
    "yallist": "^3.1.1"
  },
  "devDependencies": {
    "css-loader": "^3.2.0",
    "html-loader": "^0.5.5",
    "html-webpack-plugin": "^3.2.0",
    "style-loader": "^1.0.0",
    "ts-loader": "^6.2.1",
    "webpack": "^4.41.2",
    "webpack-cli": "^3.3.10"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "build": "webpack",
    "buildv": "webpack --verbose --progress --debug --profile",
    "buildp": "webpack --plugin webpack/lib/debug/ProfilingPlugin"
  },
  "author": "",
  "license": "ISC"
}

系统:

enter image description here

有什么想法可以弄清楚世界上花费了这么长时间吗?

0 个答案:

没有答案