jharris4 / html-webpack-tags-plugin

lets you define html tags to inject with html-webpack-plugin
MIT License
256 stars 31 forks source link

Compatibility with html-webpack-plugin@4.0.0-beta.5 #45

Closed surgeboris closed 5 years ago

surgeboris commented 5 years ago

I'm using webpack@4.30.0, so (as far as I understand) I supposed to use html-webpack-plugin@4.0.0-beta.5 (previous versions wouldn't work, would they?).

With html-webpack-include-assets-plugin@1.0.10 everything works correctly, but when I'm trying to use html-webpack-tags-plugin@2.0.5 (or html-webpack-include-assets-plugin@2.0.0) the build breaks with the following error:

/node_modules/html-webpack-tags-plugin/index.js:503
        throw new Error(message);
        ^

Error: Error running html-webpack-tags-plugin, are you sure you have html-webpack-plugin before it in your webpack config's plugins?
    at onCompilation (/node_modules/html-webpack-tags-plugin/index.js:503:15)
    at SyncHook.eval [as call] (eval at create (/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:11:1)
    at SyncHook.lazyCompileHook (/node_modules/tapable/lib/Hook.js:154:20)
    at Compiler.newCompilation (/node_modules/webpack/lib/Compiler.js:581:26)
    at hooks.beforeCompile.callAsync.err (/node_modules/webpack/lib/Compiler.js:617:29)
    at _err0 (eval at create (/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:11:1)
    at Array.compiler.inputFileSystem.readFile (/node_modules/webpack/lib/DllReferencePlugin.js:72:15)
    at Storage.finished (/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:43:16)
    at provider (/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:79:9)
    at /node_modules/graceful-fs/graceful-fs.js:90:16
    at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3)

To me it looks like a regression, although it might be version mismatch or plugin misuse on my side. Do you have any idea what's the problem here?

jharris4 commented 5 years ago

I'll have to take a look at html-webpack-plugin@4 support, I'll get back to you.

jharris4 commented 5 years ago

I think I know the change that broke it, but I'll have to find some time to try and test a fix with the 4.x beta.

jharris4 commented 5 years ago

Ok, I fixed the issue, released in 2.0.6.

I figured out a way to make this plugin's test suite run against both versions of html-webpack-plugin so I'm now confident that it works with both. :-)

surgeboris commented 5 years ago

2.0.6 works for me now. This issue can be closed.

raman-kazhadub commented 5 years ago

Hi @jharris4 , I have the same error for : node v10.15.3 "webpack": "^4.32.0", "html-webpack-plugin": "^3.2.0", "html-webpack-tags-plugin": "^2.0.12"

What versions should I use to fix the problem? Regards

jharris4 commented 5 years ago

@raman-kazhadub all versions should be working.

There's a good chance you haven't put the html-webpack-plugin before the html-webpack-tags-plugin in the plugins array in your webpack config.

If you share more details about your webpack config I can try and offer some suggestions.

raman-kazhadub commented 5 years ago

@jharris4 , Please see the example here: https://github.com/raman-kazhadub/react-typescript-webpack4 try to use npm run build:dev or yarn build:dev

jharris4 commented 5 years ago

@raman-kazhadub ok I looked at your webpack config and I see that you are using the speed-measure-webpack-plugin.

It looks like you are having the same issue as #35

Can you try removing the speed-measure-webpack-plugin and see if that fixes the issue?