-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Webpack 5: The 'compilation' argument must be an instance of Compilation #1451
Comments
@ebuchmann I had a similar error and it was because of having "webpack" installed in 2 places (monorepo), in such case it trigger this error (just having 1 works). Therefore, at least in my case, it is related to the node resolution. |
thx a lot ! |
what's progress of this issue ? i faced the same issue of "webpack": "^5.0.0-beta.30", |
upgrade webpack to 5.1.0 |
@chunlai996 i upgrade to [email protected] & html-webpack-plugin@next (alpha.5) it also throw this issue.
|
I don't have this kind of error using [email protected], [email protected] and [email protected].
@tianyingchun Do you have another pluygin inside your configuration that might occur this error ? |
I have also troubles to reproduce this issue |
@jantimon @Thebarda i have just remove all plugins, just remain
it still throw this error, if remove |
BTW i don't use
|
can you add a console log where the error occurs and output |
@jantimon i try to start new repo with simplify webpack configurations to reproduce issue, but surprised it work fine can build success without errors, does not report me a error, the repo is Maybe i need to some more time to investigate for this, be cause my real project is more complex than this |
@jantimon i found how to reproduce this issue, if i put create in repo
in repo and then run the webpack build it will throw errors. if i copy all codes Why ? Or is there a wrong while in usage of plugin of |
Got same problem. But with another config. Fir project I'm using gulp with webpack-stream and keep config into one file (gulpfile). There are only Vue loaders, styles and nothing else. Problem git during updating to new Vue 3, Vuex and also upgraded webpack from 4 to 5. Fixed by downgrading webpack to 4th. |
I believe this might happen if multiple different webpack versions are installed - if webpack uses instanceOf to verify the passed values it might fail because compilation was constructed with a foreign Compilation constructor |
@jantimon no the two modules have the same version of |
Can you please try to find the reason of this problem using |
:) i totally migrate my code into single repo now, keep |
Ok I found the root cause of my issue
the situation is that I have the structure like root and while execution happen in example/ directory, then it resolves them to both locations. I am not digging into it deeper but the fastest resolution is to link the root library in nested project for lerna project running bootstrap with --hoist should deal with it as well as for yarn workspaces |
Can confirm the workspaces issue. I'm using yarn workspaces, No dependencies are hoisted (
The I have a work around that cause the shared Originally, the shared const HtmlWebpackPlugin = require('html-webpack-plugin'); Changing it to the following causes const HtmlWebpackPlugin = require(require.resolve('html-webpack-plugin', { paths: [process.cwd()] })); Edit: This might be a slightly more portable solution given that relative to the const _require = id => require(require.resolve(id, { paths: [require.main.path] }));
const HtmlWebpackPlugin = _require('html-webpack-plugin'); |
solved? I have the same problem |
ERROR in TypeError: The 'compilation' argument must be an instance of Compilation
webpack 5.0.0 compiled with 1 error in 1412 ms |
I guess there is no way that we could solve this on html-webpack-plugin side.. |
Download the 4 version of webpack try, 5 version changed a lot of content |
npx webpack |
This is the new code in webpack 5 which is causing the problem:
please move this issue to https://github.com/webpack/webpack/issues |
Probably fixed in |
Hi, I faced the same issue and tried almost every possible permutation of the configuration settings explained here. My dev dependencies are:
And the fun part is that this was working on one Windows machined and giving the The solution was as simple as running the terminal as administrator for running the npm commands ( I hope this will help someone to save some time :) |
@theVoogie the fix is not part of |
It can be fixed using @5.0.0-alpha.9, but the <script> was introduced in the header |
@Night-Day-X yes that's an performance improvement - you can change that back with the |
I can confirm |
Got this issue too,with
(maybe the last stable version) in |
This issue is not related to html-webpack-plugin. It is happening even I don't use it |
Expected behaviour
Should correctly update the html file with script tags.
Current behaviour
Trying to update my project to webpack 5 beta 16.
Getting an error running webpack-dev-server. When I remove the html-webpack-plugin from my config it compiles fine, but keep getting the following error:
Environment
Node.js v10.16.3
darwin 18.7.0
npm 6.9.0
yarn 1.22.0
[email protected] extraneous
[email protected]
Config
It seems to just have a problem with this project. I tried to get a minimal repo going, except it works fine there. Not sure what's going on within this project, but I've been trying to remove other things to see if it's something else without any luck.
The text was updated successfully, but these errors were encountered: