用下面的代码 import
import _contentStyle from './tinymce5.content.less';
build 时会报错
TS2307: Cannot find module './tinymce5.content.less' or its corresponding type declarations. [plugin angular-compiler]
用的是 angular 19,build 引擎用的是 esbuild
微信里点“发现”,扫一下
二维码便可将本文分享至朋友圈。
通过 with loader 解决了
import _contentStyle from './tinymce5.content.less' with { loader: 'text' };
上面的方法只能实现将 .less 文件的原始内容作为字符串赋值给 _contentStyle,less 不会被编译成 css,如何先编译成 css 再作为字符串 import 详见博问 https://q.cnblogs.com/q/151668