使用了extract-text-webpack-plugin插件后,编译出错,信息如下,求讲解

来源:4-1 webpack配置css单独分离打包

XPoet

2018-03-08 18:23

(node:9624) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead

(node:9624) DeprecationWarning: Tapable.apply is deprecated. Call apply on the plugin directly instead

C:\Users\zsl08.000\Desktop\Vue-Webpack-todo\node_modules\webpack\lib\Chunk.js:460

                throw new Error(

                ^


Error: Chunk.entrypoints: Use Chunks.groupsIterable and filter by instanceof Entrypoint instead


写回答 关注

9回答

  • 慕神0028795
    2018-03-20 15:41:27
    已采纳

    npm install extract-text-webpack-plugin@next

    慕UI524... 回复慕慕1621...

    我也是相同的问题,请问你解决了吗

    2018-05-25 11:17:58

    共 4 条回复 >

  • AI54
    2018-05-03 18:30:38

    npm install extract-text-webpack-plugin@next 正解, webpack 4+版本的问题解决了,感谢啊

  • 慕圣5950399
    2018-04-27 15:22:56

    npm install extract-text-webpack-plugin@next 正解webpack4运行正常

  • HatakeKkshi
    2018-04-01 21:48:35

    我的webpack是3.10.0的;使用npm install extract-text-webpack-plugin@next之后,执行webpack解决了

  • 半晴雨滴
    2018-03-30 08:46:13

    楼上的方法都试过了,还是报错:

    Error: Chunk.entrypoints: Use Chunks.groupsIterable and filter by instanceof Entrypoint instead

    Hatake...

    我现在也报这个错误,你的解决了吗

    2018-04-01 21:41:23

    共 1 条回复 >

  • 慕神0028795
    2018-03-20 17:27:44

    对比一下你的package.json

    {
      "name": "webpack-vue-test",
      "version": "1.0.0",
      "description": "",
      "main": "index.js",
      "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1",
        "build": "cross-env NODE_ENV=production webpack --config webpack.config.js",
        "dev": "cross-env NODE_ENV=development webpack-dev-server --config webpack.config.js"
      },
      "author": "",
      "license": "ISC",
      "dependencies": {
        "autoprefixer": "^8.1.0",
        "babel-core": "^6.26.0",
        "babel-helper-vue-jsx-merge-props": "^2.0.3",
        "babel-loader": "^7.1.4",
        "babel-plugin-syntax-jsx": "^6.18.0",
        "babel-plugin-transform-vue-jsx": "^3.7.0",
        "babel-preset-env": "^1.6.1",
        "cross-env": "^5.1.4",
        "css-loader": "^0.28.10",
        "extract-text-webpack-plugin": "^4.0.0-beta.0",
        "file-loader": "^1.1.11",
        "html-webpack-plugin": "^3.0.6",
        "postcss-loader": "^2.1.1",
        "style-loader": "^0.20.3",
        "stylus": "^0.54.5",
        "stylus-loader": "^3.0.2",
        "url-loader": "^1.0.1",
        "vue": "^2.5.16",
        "vue-loader": "^14.2.1",
        "vue-template-compiler": "^2.5.16",
        "webpack": "^4.1.1",
        "webpack-cli": "^2.0.12",
        "webpack-dev-server": "^3.1.1"
      }
    }

  • 慕神0028795
    2018-03-20 17:26:44

       把这一段替换一下试试

    config.plugins.push(
            new ExtractPlugin('styles.[contentHash:8].css'),
            // new webpack.optimize.CommonsChunkPlugin({
            //     name:'vendor'
            // })
        )

        config.optimization = {
            splitChunks: {
                cacheGroups: {
                    commons: {
                        chunks: 'initial',
                        minChunks: 2, maxInitialRequests: 5,
                        minSize: 0
                    },
                    vendor: {
                        test: /node_modules/,
                        chunks: 'initial',
                        name: 'vendor',
                        priority: 10,
                        enforce: true
                    }
                }
            },
            runtimeChunk: true
        }

  • XPoet
    2018-03-12 11:45:44

    好的,我试试

  • 小冷咩
    2018-03-12 11:20:25

    你用的应该是webpack4吧,换成mini-css-extract-plugin就好了,用法:https://www.npmjs.com/package/mini-css-extract-plugin

    qq_心星_...

    正解,赞

    2021-07-30 10:18:00

    共 1 条回复 >

Vue+Webpack打造todo应用

用前端最热门框架Vue+最火打包工具Webpack打造todo应用

84606 学习 · 787 问题

查看课程

相似问题