[英]"You may need an additional loader to handle the result of these loaders."
[英]You may need an additional loader to handle the result of these loaders, r = ts(a[0])
我正在使用反應打字稿,只是想為時區選擇器創建一個選擇組件。 我嘗試使用 npm 庫 react-timezone-select。 但它在控制台中給出以下錯誤:
index.js:1 ./node_modules/react-timezone-select/dist/esm/index.js 9693:38
模塊解析失敗:意外令牌 (9693:38)
使用這些加載器處理文件:
./node_modules/babel-loader/lib/index.js
您可能需要一個額外的加載器來處理這些加載器的結果。
r = ts(a[0]);
let o = "",
s = n.isDST() ? r[0].daylight?.abbr : r[0].standard?.abbr,
l = n.isDST() ? r[0].daylight?.name : r[0].standard?.name;
const u = 60 * t.current.offset,
我不知道我在做什么錯。 不能在反應打字稿中使用 npm 庫?
我嘗試使用以下命令安裝 react-timezone-select
npm i react-timezone-select
npm i @types/react-timezone-select
另外,我將tsconfig.json
文件更改為包含
"lib": ["DOM", "ES6", "DOM.Iterable", "ScriptHost", "ES2016.Array.Include", "esnext"],
"include": ["src", "backend", "src/**/*.ts", "src/**/*.tsx"]
但它都沒有奏效,同樣的錯誤是持久的。
我希望 typescript 能讓生活更輕松,但相反,它會為所有其他 npm 庫帶來更多問題。
似乎將 react-scripts 更新到 5.0.1 可以解決您的問題。 參考這個線程https://github.com/ndom91/react-timezone-select/issues/57
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.