Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breaks with HtmlWebpackHarddiskPlugin & BaseHrefWebpackPlugin #55

Open
mkaradeniz opened this issue Nov 3, 2018 · 8 comments
Open

Breaks with HtmlWebpackHarddiskPlugin & BaseHrefWebpackPlugin #55

mkaradeniz opened this issue Nov 3, 2018 · 8 comments

Comments

@mkaradeniz
Copy link

mkaradeniz commented Nov 3, 2018

Hey!

Thanks for this project :)

I ran into issues that are maybe related to #44:
When including HtmlWebpackHarddiskPlugin and/or BaseHrefWebpackPlugin I get the following errors:

HtmlWebpackHarddiskPlugin:

TypeError: HtmlWebpackPlugin.getHooks is not a function
    at Proxy.<anonymous> ([...]node_modules/html-webpack-harddisk-plugin/index.js:24:39)
    at args ([...]node_modules/speed-measure-webpack-plugin/WrappedPlugin/index.js:52:19)
    at SyncHook.eval (eval at create ([...]node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:15:1)
    at SyncHook.lazyCompileHook ([...]node_modules/tapable/lib/Hook.js:154:20)
    at Compiler.newCompilation ([...]node_modules/webpack/lib/Compiler.js:503:26)
    at hooks.beforeCompile.callAsync.err ([...]node_modules/webpack/lib/Compiler.js:539:29)
    at AsyncSeriesHook.eval [as callAsync] (eval at create ([...]node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook ([...]node_modules/tapable/lib/Hook.js:154:20)
    at Compiler.compile ([...]node_modules/webpack/lib/Compiler.js:534:28)
    at readRecords.err ([...]node_modules/webpack/lib/Compiler.js:274:11)
    at Compiler.readRecords ([...]node_modules/webpack/lib/Compiler.js:401:11)
    at hooks.run.callAsync.err ([...]node_modules/webpack/lib/Compiler.js:271:10)
    at _err0 (eval at create ([...]node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:20:1)
    at func.apply.argsButLast.map.concat.callbackArgs ([...]node_modules/speed-measure-webpack-plugin/WrappedPlugin/index.js:44:9)
    at Proxy.<anonymous> ([...]node_modules/awesome-typescript-loader/src/watch-mode.ts:7:4)
    at args ([...]node_modules/speed-measure-webpack-plugin/WrappedPlugin/index.js:40:16)

BaseHrefWebpackPlugin:

TypeError: Cannot read property 'tapAsync' of undefined
    at Proxy.tapAsync ([...]node_modules/base-href-webpack-plugin/index.js:12:63)
    at args ([...]node_modules/speed-measure-webpack-plugin/WrappedPlugin/index.js:52:19)
    at SyncHook.eval (eval at create ([...]node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:15:1)
    at SyncHook.lazyCompileHook ([...]node_modules/tapable/lib/Hook.js:154:20)
    at Compiler.newCompilation ([...]node_modules/webpack/lib/Compiler.js:503:26)
    at hooks.beforeCompile.callAsync.err ([...]node_modules/webpack/lib/Compiler.js:539:29)
    at AsyncSeriesHook.eval [as callAsync] (eval at create ([...]node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook ([...]node_modules/tapable/lib/Hook.js:154:20)
    at Compiler.compile ([...]node_modules/webpack/lib/Compiler.js:534:28)
    at readRecords.err ([...]node_modules/webpack/lib/Compiler.js:274:11)
    at Compiler.readRecords ([...]node_modules/webpack/lib/Compiler.js:401:11)
    at hooks.run.callAsync.err ([...]node_modules/webpack/lib/Compiler.js:271:10)
    at _err0 (eval at create ([...]node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:20:1)
    at func.apply.argsButLast.map.concat.callbackArgs ([...]node_modules/speed-measure-webpack-plugin/WrappedPlugin/index.js:44:9)
    at Proxy.<anonymous> ([...]node_modules/awesome-typescript-loader/src/watch-mode.ts:7:4)
    at args ([...]node_modules/speed-measure-webpack-plugin/WrappedPlugin/index.js:40:16)
`webpack.config.js` (With both plugins enabled)

{
  "devtool": false,
  "entry": {
    "app": [
      "@babel/polyfill",
      "[...]/src/app/index.jsx"
    ]
  },
  "mode": "production",
  "module": {
    "rules": [
      {
        "oneOf": [
          {
            "test": [
              {},
              {},
              {},
              {}
            ],
            "use": [
              {
                "loader": "url-loader",
                "options": {
                  "limit": 1000,
                  "fallback": "file-loader",
                  "name": "assets/[path][name].[hash:8].[ext]",
                  "publicPath": "/nachrichten"
                }
              }
            ]
          },
          {
            "test": {},
            "use": [
              {
                "loader": "babel-loader",
                "options": {
                  "presets": [
                    [
                      "[...]/node_modules/@babel/preset-env/lib/index.js",
                      {
                        "modules": "commonjs",
                        "targets": {
                          "browsers": [
                            "last 2 versions",
                            "ie >= 11"
                          ]
                        }
                      }
                    ],
                    "[...]/node_modules/@babel/preset-react/lib/index.js",
                    "[...]/node_modules/@babel/preset-flow/lib/index.js"
                  ],
                  "plugins": [
                    "[...]/node_modules/babel-plugin-macros/dist/index.js",
                    "[...]/node_modules/@babel/plugin-transform-runtime/lib/index.js",
                    [
                      "[...]/node_modules/babel-plugin-transform-react-remove-prop-types/lib/index.js",
                      {
                        "mode": "unsafe-wrap"
                      }
                    ],
                    [
                      "[...]/node_modules/@babel/plugin-proposal-class-properties/lib/index.js",
                      {
                        "loose": true
                      }
                    ],
                    "[...]/node_modules/@babel/plugin-syntax-dynamic-import/lib/index.js",
                    "[...]/node_modules/babel-plugin-minify-dead-code-elimination/lib/index.js",
                    "[...]/node_modules/babel-plugin-idx/lib/babel-plugin-idx.js",
                    "[...]/node_modules/babel-plugin-relay/index.js",
                    "[...]/node_modules/react-loadable/babel.js",
                    [
                      "[...]/node_modules/babel-plugin-styled-components/lib/index.js",
                      {
                        "displayName": true,
                        "preprocess": false,
                        "ssr": true
                      }
                    ]
                  ]
                }
              }
            ],
            "exclude": {}
          },
          {
            "test": {},
            "use": [
              {
                "loader": "babel-loader",
                "options": {
                  "presets": [
                    [
                      "[...]/node_modules/@babel/preset-env/lib/index.js",
                      {
                        "modules": "commonjs",
                        "targets": {
                          "browsers": [
                            "last 2 versions",
                            "ie >= 11"
                          ]
                        }
                      }
                    ],
                    "[...]/node_modules/@babel/preset-react/lib/index.js",
                    "[...]/node_modules/@babel/preset-flow/lib/index.js"
                  ],
                  "plugins": [
                    "[...]/node_modules/babel-plugin-macros/dist/index.js",
                    "[...]/node_modules/@babel/plugin-transform-runtime/lib/index.js",
                    [
                      "[...]/node_modules/babel-plugin-transform-react-remove-prop-types/lib/index.js",
                      {
                        "mode": "unsafe-wrap"
                      }
                    ],
                    [
                      "[...]/node_modules/@babel/plugin-proposal-class-properties/lib/index.js",
                      {
                        "loose": true
                      }
                    ],
                    "[...]/node_modules/@babel/plugin-syntax-dynamic-import/lib/index.js",
                    "[...]/node_modules/babel-plugin-minify-dead-code-elimination/lib/index.js",
                    "[...]/node_modules/babel-plugin-idx/lib/babel-plugin-idx.js",
                    "[...]/node_modules/babel-plugin-relay/index.js",
                    "[...]/node_modules/react-loadable/babel.js",
                    [
                      "[...]/node_modules/babel-plugin-styled-components/lib/index.js",
                      {
                        "displayName": true,
                        "preprocess": false,
                        "ssr": true
                      }
                    ]
                  ]
                }
              },
              {
                "loader": "ts-loader",
                "options": {
                  "configFile": "[...]/tsconfig.json",
                  "logInfoToStdOut": true
                }
              }
            ],
            "exclude": {}
          },
          {
            "test": {},
            "use": [
              "[...]/node_modules/mini-css-extract-plugin/dist/loader.js",
              {
                "loader": "css-loader",
                "options": {
                  "importLoaders": 2,
                  "localIdentName": "[local]___[hash:base64:5]",
                  "modules": true,
                  "sourceMap": false
                }
              },
              {
                "loader": "postcss-loader",
                "options": {
                  "ident": "postcss",
                  "plugins": [
                    null
                  ],
                  "publicPath": "/nachrichten/assets",
                  "sourceMap": false
                }
              }
            ]
          },
          {
            "test": {},
            "use": [
              "[...]/node_modules/mini-css-extract-plugin/dist/loader.js",
              {
                "loader": "css-loader",
                "options": {
                  "importLoaders": 3,
                  "localIdentName": "[local]___[hash:base64:5]",
                  "modules": true,
                  "sourceMap": false
                }
              },
              {
                "loader": "postcss-loader",
                "options": {
                  "ident": "postcss",
                  "plugins": [
                    null
                  ],
                  "publicPath": "/nachrichten/assets",
                  "sourceMap": false
                }
              },
              {
                "loader": "sass-loader",
                "options": {
                  "sourceMap": false
                }
              }
            ]
          },
          {
            "test": {},
            "use": [
              "[...]/node_modules/mini-css-extract-plugin/dist/loader.js",
              {
                "loader": "css-loader",
                "options": {
                  "importLoaders": 3,
                  "localIdentName": "[local]___[hash:base64:5]",
                  "modules": true,
                  "sourceMap": false
                }
              },
              {
                "loader": "postcss-loader",
                "options": {
                  "ident": "postcss",
                  "plugins": [
                    null
                  ],
                  "publicPath": "/nachrichten/assets",
                  "sourceMap": false
                }
              },
              {
                "loader": "less-loader",
                "options": {
                  "sourceMap": false
                }
              }
            ]
          },
          {
            "test": {},
            "use": [
              {
                "loader": "html-loader"
              },
              {
                "loader": "markdown-loader"
              }
            ]
          },
          {
            "test": {},
            "oneOf": [
              {
                "issuer": {},
                "use": [
                  {
                    "loader": "url-loader"
                  }
                ]
              },
              {
                "issuer": {},
                "use": [
                  {
                    "loader": "svg-react-loader"
                  }
                ]
              }
            ]
          },
          {
            "exclude": [
              {},
              {},
              {}
            ],
            "use": [
              {
                "loader": "file-loader",
                "options": {
                  "name": "assets/[path][name].[hash:8].[ext]",
                  "publicPath": "/nachrichten"
                }
              }
            ]
          }
        ]
      }
    ]
  },
  "optimization": {
    "minimizer": [
      {
        "options": {
          "test": {},
          "extractComments": false,
          "sourceMap": false,
          "cache": true,
          "parallel": true,
          "uglifyOptions": {
            "output": {
              "comments": {}
            }
          }
        }
      },
      {
        "pluginDescriptor": {
          "name": "OptimizeCssAssetsWebpackPlugin"
        },
        "options": {
          "assetProcessors": [
            {
              "phase": "compilation.optimize-chunk-assets",
              "regExp": {}
            }
          ],
          "assetNameRegExp": {},
          "cssProcessorOptions": {},
          "cssProcessorPluginOptions": {}
        },
        "phaseAssetProcessors": {
          "compilation.optimize-chunk-assets": [
            {
              "phase": "compilation.optimize-chunk-assets",
              "regExp": {}
            }
          ],
          "compilation.optimize-assets": [],
          "emit": []
        },
        "deleteAssetsMap": {}
      }
    ],
    "splitChunks": {
      "cacheGroups": {
        "common": {
          "name": "common",
          "chunks": "async",
          "enforce": true,
          "minChunks": 2,
          "priority": 10,
          "reuseExistingChunk": true
        },
        "lottie": {
          "name": "lottie-web",
          "chunks": "all",
          "priority": 30,
          "test": {}
        },
        "vendors": {
          "name": "vendors",
          "chunks": "all",
          "priority": 20,
          "test": {}
        }
      }
    }
  },
  "output": {
    "filename": "assets/[name]_[contenthash].js",
    "path": "[...]/dist/web",
    "publicPath": "/nachrichten/"
  },
  "performance": {},
  "plugins": [
    {
      "options": {},
      "pathCache": {},
      "fsOperations": 0,
      "primed": false
    },
    {},
    {
      "opts": {
        "publicPath": null,
        "basePath": "",
        "fileName": "manifest.json",
        "transformExtensions": {},
        "writeToFileEmit": false,
        "seed": null,
        "filter": null,
        "map": null,
        "generate": null,
        "sort": null
      }
    },
    {
      "keys": [
        "NODE_ENV",
        "BIND_PORT",
        "BRANCH",
      ],
      "defaultValues": {}
    },
    {
      "options": {}
    },
    {
      "preferEntry": false
    },
    {
      "opts": {
        "filename": "stats.json",
        "fields": null
      }
    },
    {
      "options": {
        "template": "./public/index.html",
        "filename": "index.html",
        "hash": false,
        "inject": true,
        "compile": true,
        "favicon": false,
        "minify": false,
        "cache": true,
        "showErrors": true,
        "chunks": "all",
        "excludeChunks": [],
        "chunksSortMode": "auto",
        "meta": {},
        "title": "Webpack App",
        "xhtml": false
      }
    },
    {},
    {
      "filename": "./dist/web/react-loadable.json"
    },
    {
      "options": {
        "baseHref": "/nachrichten/"
      }
    },
    {
      "options": {
        "filename": "assets/[name]_[contenthash].css",
        "chunkFilename": "assets/[name]_[contenthash].css"
      }
    },
    {
      "options": {
        "name": "Analysis Build (web)",
        "color": "#800087",
        "profile": false,
        "compiledIn": true,
        "done": null,
        "minimal": false,
        "stream": null
      }
    },
    {
      "opts": {
        "analyzerMode": "static",
        "analyzerHost": "127.0.0.1",
        "analyzerPort": 8888,
        "reportFilename": "./reports/bundleAnalyzerReport.html",
        "defaultSizes": "parsed",
        "openAnalyzer": false,
        "generateStatsFile": false,
        "statsFilename": "stats.json",
        "statsOptions": null,
        "excludeAssets": null,
        "logLevel": "silent",
        "startAnalyzer": true
      },
      "server": null,
      "logger": {
        "activeLevels": {}
      }
    },
    {
      "opts": {
        "filename": "./reports/webpackVisualizerReport.html"
      }
    },
    {
      "options": {},
      "timeEventData": {},
      "smpPluginAdded": true
    }
  ],
  "resolve": {
    "extensions": [
      ".js",
      ".jsx",
      ".ts",
      ".tsx",
      ".json",
      ".mjs"
    ],
    "modules": [
      "node_modules"
    ]
  },
  "target": "web"
}

@sibelius
Copy link

sibelius commented Nov 6, 2018

it breaks with favicons-webpack-plugin as well

10% building modules 1/1 modules 0 activeTypeError: Cannot read property 'tapAsync' of undefined
    at Proxy.<anonymous> (/Users/sibelius/Dev/app/app/app-admin/node_modules/favicons-webpack-plugin/index.js:73:62)
    at args (/Users/sibelius/Dev/app/app/app-admin/node_modules/speed-measure-webpack-plugin/WrappedPlugin/index.js:52:19)
    at SyncHook.eval [as call] (eval at create (/Users/sibelius/Dev/app/app/app-admin/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:97:1)
    at SyncHook.lazyCompileHook (/Users/sibelius/Dev/app/app/app-admin/node_modules/tapable/lib/Hook.js:154:20)
    at Compiler.newCompilation (/Users/sibelius/Dev/app/app/app-admin/node_modules/webpack/lib/Compiler.js:503:26)
    at hooks.beforeCompile.callAsync.err (/Users/sibelius/Dev/app/app/app-admin/node_modules/webpack/lib/Compiler.js:539:29)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/sibelius/Dev/app/app/app-admin/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (/Users/sibelius/Dev/app/app/app-admin/node_modules/tapable/lib/Hook.js:154:20)
    at Compiler.compile (/Users/sibelius/Dev/app/app/app-admin/node_modules/webpack/lib/Compiler.js:534:28)
    at Compiler.runAsChild (/Users/sibelius/Dev/app/app/app-admin/node_modules/webpack/lib/Compiler.js:281:8)
    at /Users/sibelius/Dev/app/app/app-admin/node_modules/favicons-webpack-plugin/lib/compiler.js:75:19
    at new Promise (<anonymous>)
    at Object.compileTemplate (/Users/sibelius/Dev/app/app/app-admin/node_modules/favicons-webpack-plugin/lib/compiler.js:74:10)
    at Proxy.<anonymous> (/Users/sibelius/Dev/app/app/app-admin/node_modules/favicons-webpack-plugin/index.js:48:19)
    at args (/Users/sibelius/Dev/app/app/app-admin/node_modules/speed-measure-webpack-plugin/WrappedPlugin/index.js:40:16)
    at AsyncParallelHook.eval [as callAsync] (eval at create (/Users/sibelius/Dev/app/app/app-admin/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:13:1)
    at AsyncParallelHook.lazyCompileHook (/Users/sibelius/Dev/app/app/app-admin/node_modules/tapable/lib/Hook.js:154:20)
    at hooks.beforeCompile.callAsync.err (/Users/sibelius/Dev/app/app/app-admin/node_modules/webpack/lib/Compiler.js:541:20)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/sibelius/Dev/app/app/app-admin/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (/Users/sibelius/Dev/app/app/app-admin/node_modules/tapable/lib/Hook.js:154:20)
    at Compiler.compile (/Users/sibelius/Dev/app/app/app-admin/node_modules/webpack/lib/Compiler.js:534:28)
    at compiler.hooks.watchRun.callAsync.err (/Users/sibelius/Dev/app/app/app-admin/node_modules/webpack/lib/Watching.js:76:18)
    at _err2 (eval at create (/Users/sibelius/Dev/app/app/app-admin/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:32:1)
    at func.apply.argsButLast.map.concat.callbackArgs (/Users/sibelius/Dev/app/app/app-admin/node_modules/speed-measure-webpack-plugin/WrappedPlugin/index.js:44:9)
    at /Users/sibelius/Dev/app/app/app-admin/node_modules/happypack/node_modules/async/lib/async.js:721:13
    at /Users/sibelius/Dev/app/app/app-admin/node_modules/happypack/node_modules/async/lib/async.js:52:16
    at /Users/sibelius/Dev/app/app/app-admin/node_modules/happypack/node_modules/async/lib/async.js:269:32
    at /Users/sibelius/Dev/app/app/app-admin/node_modules/happypack/node_modules/async/lib/async.js:44:16
    at /Users/sibelius/Dev/app/app/app-admin/node_modules/happypack/node_modules/async/lib/async.js:718:17
    at /Users/sibelius/Dev/app/app/app-admin/node_modules/happypack/node_modules/async/lib/async.js:167:37

@stephencookdev
Copy link
Owner

Hey guys - thanks for raising. I'll do my best to take a look at these plugins when I get a mo.

Is it on a regular build that you hit the error, or on an incremental build?

@sibelius
Copy link

sibelius commented Nov 7, 2018

regular one

@mkaradeniz
Copy link
Author

Thanks!

Yes, regular too.

@alxpsr
Copy link

alxpsr commented Mar 21, 2019

same problem

1 similar comment
@shudery
Copy link

shudery commented Mar 26, 2019

same problem

@X-Jagger
Copy link

broken with html-webpack-include-assets-plugin too.

@alireza-mh
Copy link

update my package to the latest and now it works.
html-webpack-plugin: 4.5.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants