[英]"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.