-
-
Notifications
You must be signed in to change notification settings - Fork 383
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
Module build failed: TypeError: this[NS] is not a function #73
Comments
I'm not sure if this will help but I was getting this error only on my dev builds because I was only adding the plugin on prod even though both prod and dev were both using the loader. |
@nicksrandall what do you mean by adding to prod? Do you mean adding to "dependencies" instead of "devDependencies"? If so, I tried here and it didn't work. |
I found out something that It might help. NS still have the same value, but |
No, he means that he added the plugin to production config of webpack leaving out the development config. Adding the plugin to a common config shared across prod and dev configs would solve the problem. |
@felipero Add it to both prod and dev configs. |
@nurbek-ab On my example over there, that config is the common config between dev and prod. Which means it is already added to both dev and prod. The issue for me is when I require it directly from the html. |
@felipero I am not sure if it helps but try to update webpack to 4.5.0 |
@nurbek-ab Did it already. Didn't solve either. I just tried again and whenever I add a require to the index.html it breaks. Worth mention that I'm using the |
Same here |
I had this issue when using less-loader down the chain, adding the
|
It is bug, feel free to fix it |
Bug happens when you add loader, but don't add plugin |
Also somebody can create minimum reproducible test repo with |
@nicksrandall thanks for this, I was accidentally blowing away the plugin portion of this in my dev setup via Object.assign and forgetting it's not a deep merge. User error, fixed for me. |
In the case when you have included the plugin and are not blowing it away, this seems to be an issue when the loader and the plugin are not coming from the same source. I have a case where I have abstracted away a lot of my configurations to be easily imported into various projects to make things easier to manage. I noticed that |
I use Webpack 4.5 and I got this error as well. I fixed it by adding
to my plugin section. I know that this was not the problem above... Just in case someone does the same mistake I did... :-) |
@felipero |
@toBeTheLight Not sure I understood what you meant. In my example I added the loader AND the plugin: https://github.com/felipero/mini-css-extract-plugin-ns-bug/blob/master/webpack.config.js#L7 Could you clarify what you mean by |
I had seen it mentioned on this thread. Still, I was stung by accidentally using the Details: I am using webpack to build both server and client. I have shared webpack config objects in one file. I was accidentally mutating the css loader object, adding the MiniCssExtractPlugin.loader to it on the client side webpack config. The client side does correctly add the |
@felipero So you are able to reproduce with the plugin enabled in the same file as the loader? |
@tech4him1 Please, read the code in the description of this issue. An image to help: http://jmp.sh/sIV2NCK |
Adding |
some error throw from |
I'm struggling to follow. Has this issue been closed because in issue #140 the solution was that |
is this a thing where I cannot use this plugin in a childCompiler???? |
I just faced a similar issue ( |
@MoOx Huge thanks ! I got this error by not adding correct plugins into webpack config. |
Is it correct that this error appears in two cases:
Was 2. ever fixed or is there a known workaround? I tried to prerender a React page with the |
According to this comment. I've got the same issue. For me the problem was with html-webpack-plugin. I solved that by upgrading it to the latest version |
This happened to me because I had 2 'plugin' sections in webpack.config, one at the top and one at the bottom... After consolidating them into one plugin entry, it resolved the error. |
I still get this problem when trying to include a css file in a html template.
|
I found the same bug and the only solution that worked was @RubtsovAV #73 (comment) I tried with html-webpack-plugin 4.0.0-beta.11 and still didn't work, I still get As others have said, the bug seems to appear in child-compilers. |
Seeing something similar in an app from
|
@michaelmior Node v13.2.0 also has something similar output with CRA + latest
|
Same here with the latest
|
Please don't spam same issues, we known about the problem |
Sorry for delay. Here two cases:
All related issues to |
After a fresh install of webpack 4.4.1 and mini-css-extract-plugin I'm getting this error:
My configuration file looks like this:
The line with error is this:
And the value of NS is:
Any ideas of what it could be?
The text was updated successfully, but these errors were encountered: