antd-dayjs-webpack-plugin icon indicating copy to clipboard operation
antd-dayjs-webpack-plugin copied to clipboard

ypeError: getOptions is not a function

Open ashuihui opened this issue 4 years ago • 8 comments

ERROR in ./node_modules/antd-dayjs-webpack-plugin/src/init-dayjs-webpack-plugin-entry.js Module build failed (from ./node_modules/antd-dayjs-webpack-plugin/src/init-loader.js): TypeError: getOptions is not a function

ashuihui avatar Jun 15 '21 11:06 ashuihui

loader-utils 0.2.17 删除了 getOptions:parseQuery() will be replaced with getOptions() in the next major version of loader-utils. 你解决了吗

thinkingc avatar Sep 29 '21 02:09 thinkingc

同问,这个问题要怎么解决呢

jsm1003 avatar Nov 02 '21 13:11 jsm1003

removed getOptions in favor loaderContext.getOptions ...

Breaking Changes in loader-utils v3

It is breaking change, you need webpack v5 to use this.getOptions, getOptions was removed, if you need webpack v4 support please use v2

https://github.com/webpack/loader-utils/issues/201#issuecomment-989709467

dimbslmh avatar Jan 06 '22 09:01 dimbslmh

maybe you should add loader-utils as dependencies? so it works with pnpm

jonirrings avatar Apr 21 '22 08:04 jonirrings

maybe you should add loader-utils as dependencies? so it works with pnpm

It seems that Webpack V5 has method this.getOptions() to get options, and if we want to get options we don't need to use this lib? This is my view. 好家伙,原来不是歪果仁。现在webpack5好像自带了方法,可以获取options,所以我们如果只想获取options的话,这个库应该是不必要的吧

whale2002 avatar Apr 23 '22 12:04 whale2002

@coder-chin with pnpm, only top and direct dependencies could be referenced, thus "require(‘loader-utils’)" will fail. pnpm下只能引用顶层依赖和直属依赖,require(‘loader-utils’)就会失败。

jonirrings avatar Apr 24 '22 13:04 jonirrings

是否有解决办法

BenThang avatar Apr 16 '23 06:04 BenThang