🐛 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:
|
function svgrLoader( |
|
this: webpack.LoaderContext<LoaderOptions>, |
|
contents: string, |
|
): void { |
|
this.cacheable && this.cacheable() |
|
const callback = this.async() |
|
|
|
const options = this.getOptions() |
|
|
|
const previousExport = (() => { |
|
if (contents.startsWith('export ')) return contents |
|
const exportMatches = contents.match(/^module.exports\s*=\s*(.*)/) |
|
return exportMatches ? `export default ${exportMatches[1]}` : null |
|
})() |
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
🐛 Bug Report
Last release v6.0.0 provoked the following issue :
TypeError: this.getOptions is not a functionWhich is referring to the following call:
svgr/packages/webpack/src/index.ts
Lines 58 to 71 in 81369db
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The compilation process fails and throws an exception :
Failed to compile. TypeError: this.getOptions is not a functionThis 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-utilswhich brought the following breaking change :