ts-loader icon indicating copy to clipboard operation
ts-loader copied to clipboard

TypeError: loaderContext.getOptions is not a function

Open albizeka opened this issue 2 years ago • 5 comments

yntax Error: TypeError: loaderContext.getOptions is not a function

@ multi (webpack)-dev-server/client?http://localhost:8081/sockjs-node (webpack)/hot/dev-server.js ./src/main.ts

I upgraded my app from vue 3 js to vue 3 typescript and this error occurs when i try to start the dev server:

I tried to downgrade webpack to version 4, also the ts-loader to 8.2.0 and node version but non of these works.

Does anybody solved this issue?

albizeka avatar Jun 29 '22 16:06 albizeka

I have same issue, after upgrading it to latest version

stefankuburovic avatar Jul 18 '22 14:07 stefankuburovic

Me too. I used vue-cli to initialize a vue3 project and then executed vue add electron-builder. Run npm run serve was successfully. Run npm run electron:serve was faild.

 error  in ./src/background.ts

Module build failed (from ./node_modules/ts-loader/index.js):
TypeError: loaderContext.getOptions is not a function
    at getLoaderOptions (/xxx/node_modules/ts-loader/dist/index.js:91:41)
    at Object.loader (/xxx/node_modules/ts-loader/dist/index.js:14:21)

 @ multi ./src/background.ts

IceApriler avatar Aug 12 '22 03:08 IceApriler

I am also experiencing this issue on a vue 3 ts project

luntdotp avatar Aug 16 '22 15:08 luntdotp

I found a workaround to downgrade only ts-loader v8 even if i use [email protected].

yarn add -D "ts-loader"@"^8.4.0"

makotokw avatar Aug 18 '22 14:08 makotokw

You need webpack v5 to use the latest version of ts-loader

alexander-akait avatar May 16 '23 13:05 alexander-akait