evrone / postcss-px-to-viewport

A plugin for PostCSS that generates viewport units (vw, vh, vmin, vmax) from pixel units. The best choice to create a scalable interface on different displays by one design size.
https://evrone.com/postcss-px-viewport
MIT License
3.07k stars 405 forks source link

无法找到模块“postcss-px-to-viewport”的声明文件 #162

Closed sz-hhb closed 1 year ago

sz-hhb commented 1 year ago

import postcssPxToViewport from "postcss-px-to-viewport"的ts 无法找到模块“postcss-px-to-viewport”的声明文件。 尝试使用 npm i --save-dev @types/postcss-px-to-viewport (如果存在),或者添加一个包含 declare module 'postcss-px-to-viewport'; 的新声明(.d.ts)文件ts(7016)

czmCWH commented 2 months ago

@sz-hhb 无法找到模块“postcss-px-to-viewport”的声明文件,请教下这个问题怎么解决🙏

sz-hhb commented 2 months ago

@czmCWH 添加一个包含 declare module 'postcss-px-to-viewport'; 的新声明(.d.ts)文件。 可以试试看能不能解决

czmCWH commented 2 months ago

@sz-hhb 是的,加个类型声明,然后需要在 import pxtovw from 'postcss-px-to-viewport' 导入时添加 // @ts-ignore 忽略才可以。已解决,感谢啦🙏 // @ts-ignore import pxtovw from 'postcss-px-to-viewport'

NobodyDJ commented 1 week ago

@czmCWH 感谢大佬 添加//@ts-ignore成功了