question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[v6.0.0] TypeError: this.getOptions is not a function

See original GitHub issue

🐛 Bug Report

Last release v6.0.0 provoked the following issue : TypeError: this.getOptions is not a function

Which is referring to the following call:

https://github.com/gregberge/svgr/blob/81369db030cf9498c4438a9273816f3dd5a673f6/packages/webpack/src/index.ts#L58-L71

To Reproduce

Steps to reproduce the behavior:

  • Compile any React 17 web project

Expected behavior

The compilation process fails and throws an exception :

Failed to compile. TypeError: this.getOptions is not a function

This unexpected behavior appeared right after upgrading to v6.0.0, it is most likely related to an incompatibility issue with the 3.0.0+ version of loader-utils which brought the following breaking change :

removed getOptions in favor loaderContext.getOptions (loaderContext is this inside loader function), 
note - special query parameters like ?something=true is not supported anymore, 
if you need this please do it on loader side, but we strongly recommend avoid it, as alternative you can use ?something=1 and handle 1 as true

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:6
  • Comments:18 (6 by maintainers)

github_iconTop GitHub Comments

6reactions
arnriucommented, Nov 29, 2021

I have exact same problem. Going back to 5.5.0 fixed it for now.

3reactions
o-megacommented, Dec 9, 2021

I had the same issue here while trying to use svgr with @storybook/react@^6.4.9. The storybook’s docs said it fully upgraded to webpack@5 , but I still see webpack@4 references in my .lock file

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: this.getOptions is not a function - vue.js
1. I am using @vue/cli 4.5.8 that includes webpack@4.46.0. From v11.0.0 of sass-loader and v8.
Read more >
[Solved]-TypeError: this.getOptions is not a function-Vue.js
I am using @vue/cli 4.5.8 that includes webpack@4.46.0. From v11.0.0 of sass-loader and v8.0.0 of less-loader, the.
Read more >
TypeError: this.getOptions is not a function 的解决(vue,react)
1.npm uninstall less-loader2.npm install less-loader@5.0.0一、报错信息TypeError: this.getOptions is not a function这个是在运行项目是遇到的 ...
Read more >
Syntax Error: TypeError: this.getOptions is not a function
ERROR Failed to compile with 1 error 上午11:51:16. error in .
Read more >
storybook使用sass报错TypeError:this.getOptions is no - 墨陌默
TypeError: this.getOptions is not a function at Object.loader (/Users/oyt/Downloads/story/node_modules/style-loader/dist/index.js:19:24)
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found