how to specify typescript version to ts-loader?
我正在安装ts-loader以与webpack配合使用。
有人知道如何选择要使用的typescript版本吗?
无论我做什么,我总是收到一条消息,说
1 | ts-loader: Using [email protected] and /app/tsconfig.json |
我打算使用typescript @ 2,但不知道如何告诉ts-loader使用正确的版本...
谢谢
不幸的是,对于使用react-scripts-ts或需要较旧版本打字机的任何其他依赖项的人,您的答案还不够。我已经在包依赖中添加了typescript^ 2.6.2,但是ts-loader仍然显示typescript2.5.3,因为" react-scripts-ts"具有依赖项" typescript":"?2.5.3",因此某种程度上该依赖关系优先。
我发现的实际解决方案是创建
1 2 3 4 5 6 7 8 9 10 11 | { "dependencies": { "react-scripts-ts": { "dependencies":{ "typescript": {"version":"2.6.2" } } } } } |
创建此文件后,我删除文件夹
如果不确定依赖树中的哪个程序包取决于某些程序包的特定版本,可以在
好,找到了
事实证明,npm已将typescript安装为依赖项。默认情况下是1.8
将typescript @ 2添加到package.json中,以正确设置typescript版本