TypeError: this[MODULE_TYPE] is not a function error caused by gatsby-plugin-netlify-cms
See original GitHub issueDescription
After updating to the latest gatsby-plugin-netlify-cms
, running gatsby build
fails and throws the following error
...
success open and validate gatsby-configs - 0.015 s
success load plugins - 0.509 s
success onPreInit - 0.012 s
success delete html and css files from previous builds - 0.005 s
success initialize cache - 0.009 s
success copy gatsby files - 0.016 s
success onPreBootstrap - 0.004 s
success source and transform nodes - 3.541 s
success building schema - 1.781 s
success createPages - 0.286 s
success createPagesStatefully - 0.666 s
success onPreExtractQueries - 0.001 s
success update schema - 0.147 s
success extract queries from components - 1.084 s
success write out requires - 0.022 s
success write out redirect data - 0.002 s
success Build manifest and related icons - 0.157 s
success onPostBootstrap - 0.165 s
⠀
info bootstrap finished - 10.776 s
⠀
success run static queries - 0.056 s — 4/4 77.12 queries/second
error Plugin gatsby-plugin-netlify-cms returned an error
ModuleBuildError: Module build failed (from ./node_modules/gatsby/node_modules/mini-css-extract-plugin/dist/loader.js):
TypeError: this[MODULE_TYPE] is not a function
- loader.js:141 childCompiler.runAsChild
[frontend]/[gatsby]/[mini-css-extract-plugin]/dist/loader.js:141:24
- Compiler.js:343 compile
[frontend]/[webpack]/lib/Compiler.js:343:11
- Compiler.js:681 hooks.afterCompile.callAsync.err
[frontend]/[webpack]/lib/Compiler.js:681:15
- Hook.js:154 AsyncSeriesHook.lazyCompileHook
[frontend]/[tapable]/lib/Hook.js:154:20
- Compiler.js:678 compilation.seal.err
[frontend]/[webpack]/lib/Compiler.js:678:31
- Hook.js:154 AsyncSeriesHook.lazyCompileHook
[frontend]/[tapable]/lib/Hook.js:154:20
- Compilation.js:1423 hooks.optimizeAssets.callAsync.err
[frontend]/[webpack]/lib/Compilation.js:1423:35
- Hook.js:154 AsyncSeriesHook.lazyCompileHook
[frontend]/[tapable]/lib/Hook.js:154:20
- Compilation.js:1414 hooks.optimizeChunkAssets.callAsync.err
[frontend]/[webpack]/lib/Compilation.js:1414:32
...
gatsby develop
works without issue.
Looking at https://github.com/webpack-contrib/mini-css-extract-plugin/issues/73, suspect it may be related
Steps to reproduce
… working on putting together a demo repo
How to Make a Minimal Reproduction: https://www.gatsbyjs.org/contributing/how-to-make-a-reproducible-test-case/
Expected result
gatsby build
complete without error
Actual result
See error above
Environment
System:
OS: Linux 4.19 Debian GNU/Linux 10 (buster) 10 (buster)
CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
Shell: 5.7.1 - /usr/bin/zsh
Binaries:
Node: 10.15.3 - ~/.nvm/versions/node/v10.15.3/bin/node
npm: 6.4.1 - ~/.nvm/versions/node/v10.15.3/bin/npm
Languages:
Python: 3.6.3 - /home/jchi/.pyenv/shims/python
Browsers:
Chrome: 78.0.3904.87
Firefox: 68.3.0esr
npmGlobalPackages:
gatsby-cli: 2.8.16
Issue Analytics
- State:
- Created 4 years ago
- Comments:16 (7 by maintainers)
Top Results From Across the Web
Error being thrown by gatsby-plugin-netlify-cms
My site builds and works in development mode, but when deployed, this error is thrown and the build fails:.
Read more >Gatsby Plugin Netlify CMS does not work with TypeScript?
I am trying to integrate gatsby-plugin-netlify-cms with Gatsby typescript and everytime I try to build the website, I get the following error ......
Read more >gatsby-plugin-netlify-cms
Function to customize webpack configuration. Function parameters: config: webpack configuration for NetlifyCMS; destructured object from onCreateWebpackConfig { ...
Read more >Build a Secure Blog with Gatsby, React, and Netlify
In this tutorial, I'll show you how to use Gatsby to create a blog that integrates with Netlify CMS for content. The app...
Read more >gatsby-plugin-netlify-cms - npm
A Gatsby plugin which generates the Netlify CMS single page app. Latest version: 7.3.0, last published: 11 days ago.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@erezrokah I’ve gotten past the
TypeError: this[MODULE_TYPE] is not a function
error after updating gatsby, some plugins, and react to the latest versions.Now I am encountering several issues, which I’ve been able to reproduce in a fresh repo here: https://github.com/vai0/repo-css-dep-issue
I’ve copied over the latest
package.json
andgatsby-config.js
into this new repoIssues:
gatsby build
, I encounter the error:gatsby develop
, which seems to be attributed to importing gatsby modules into a netlify cms preview component that it seems to have trouble handling.If I remove all gatsby dependencies from the preview component, e.g., the Link and Layout components - it solves issue 2 and 3, but the 1st issue still persists. The way I’ve been able to fix this so far is by removing the removal of
MiniCssExtractPlugin
here.using your updates from https://github.com/vai0/repo-css-dep-issue/pull/1 and running with the same node and npm versions didn’t fix it, only running with yarn did the trick 😞
@KyleAMathews is npm equally supported by Gatsby, or is yarn the preferred package manager? We’re running into a strange build issue that only occurs with npm and not yarn, not sure if worth going down the path of migrating our project over to yarn just to get over this particular problem