【问题标题】:webpack 3 DeprecationWarning: Chunk.modules is deprecatedwebpack 3 DeprecationWarning: Chunk.modules 已弃用
【发布时间】:2017-11-27 17:18:51
【问题描述】:

我收到此警告

(node:4692) DeprecationWarningChunk.modules 已弃用。请改用Chunk.getNumberOfModules/mapModules/forEachModule/containsModule

webpack v2.6.1 升级到v3 后。在v2xx 中,工作正常,但v3 给了我这个错误。

我不知道是哪个软件包导致了这个问题。任何参考资料或链接都可能会有所帮助。

我的 package.json 文件:

{
  "name": "app",
  "version": "1.0.0",
  "description": "app",
  "scripts": {
    "start": "webpack-dev-server --hot --inline --progress --colors  --port 2000"
  },
  "license": "MIT",
  "dependencies": {
    "@angular/animations": "~4.2.4",
    "@angular/common": "~4.2.4",
    "@angular/compiler": "~4.2.4",
    "@angular/core": "~4.2.4",
    "@angular/forms": "~4.2.4",
    "@angular/http": "~4.2.4",
    "@angular/material": "~2.0.0-beta.7",
    "@angular/platform-browser": "~4.2.4",
    "@angular/platform-browser-dynamic": "~4.2.4",
    "@angular/router": "~4.2.4",
    "core-js": "~2.4.1",
    "hammerjs": "~2.0.8",
    "rxjs": "~5.4.1",
    "zone.js": "~0.8.12"
  },
  "devDependencies": {
    "@angular/compiler-cli": "~4.2.4",
    "@angular/platform-server": "~4.2.4",
    "@ngtools/webpack": "~1.4.1",
    "@types/jquery": "^2.0.43",
    "@types/node": "~8.0.0",
    "@types/typeahead": "~0.11.29",
    "angular2-router-loader": "~0.3.5",
    "angular2-template-loader": "~0.6.2",
    "awesome-typescript-loader": "~3.1.3",
    "chunk-manifest-webpack2-plugin": "~1.0.1",
    "compression-webpack-plugin": "~0.4.0",
    "css-loader": "~0.14.0",
    "extract-text-webpack-plugin": "^3.0.0-beta.3",
    "file-loader": "~0.11.2",
    "html-loader": "~0.4.5",
    "html-webpack-plugin": "~2.28.0",
    "imports-loader": "^0.7.1",
    "moment": "^2.18.1",
    "null-loader": "~0.1.1",
    "raw-loader": "~0.5.1",
    "rimraf": "~2.6.1",
    "split-by-name-webpack-plugin": "~0.0.3",
    "style-loader": "~0.18.2",
    "tslint": "~5.4.3",
    "typescript": "~2.3.4",
    "uglify-js": "^3.0.19",
    "uglify-loader": "~2.0.0",
    "uglifyjs-webpack-plugin": "^0.4.6",
    "webpack": "~3.0.0",
    "webpack-bundle-analyzer": "~2.8.2",
    "webpack-chunk-hash": "~0.4.0",
    "webpack-dev-server": "~2.5.0",
    "webpack-merge": "~4.1.0",
    "webpack-uglify-parallel": "~0.1.3"
  }
}

【问题讨论】:

    标签: javascript angular npm webpack


    【解决方案1】:

    我在extract-text-webpack-plugin 3.0.0-beta.3 中收到了已弃用的警告。在我将 extract-text-webpack-plugin 更新到 v3.0.2 后跟此链接 DeprecationWarning Chunk.modules in Webpack 3.x 后,警告消失了,Webpack v3xx 可以正常工作,对我来说没有任何错误。

    网络包

    v3.8.1

    extract-text-webpack-plugin

    v3.0.2

    【讨论】:

    • 这不是问题的答案。请解释该插件的问题以及解决问题的方法。
    【解决方案2】:

    看起来是extract-text-webpack-plugin,请在此处查看相关问题:https://github.com/webpack-contrib/extract-text-webpack-plugin/issues/529

    【讨论】:

      【解决方案3】:

      从“webpack-md5-hash”交换:“0.0.5”,

      “webpack-chunk-hash”:“0.5.0”

      为我修复了警告。新包是旧包的一个分支。

      【讨论】:

        猜你喜欢
        • 2017-03-24
        • 2021-08-15
        • 2018-02-11
        • 2021-10-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-12-02
        • 1970-01-01
        相关资源
        最近更新 更多