[英]How do I import something with rollup
I'm successfully using rollup with riot-mixin-pack
by using this line at the top of my code: 通过在代码顶部使用以下行,我成功地将汇总与
riot-mixin-pack
使用:
import { domEvent, parentScope } from 'riot-mixin-pack'
When rolled up the domEvent
and parentScope
objects are included at the top of my file. 汇总后,
domEvent
和parentScope
对象将包含在我文件的顶部。
I would like to import highlight.js with one or two supported languages input my rolled up file but I can't seem to figure out the import
line I would need. 我想用一种或两种支持的语言导入Highlight.js ,输入我的汇总文件,但似乎无法弄清楚我需要的
import
行。
Any way to do this? 有什么办法吗?
Out of the box, Rollup only knows how to import ES modules (ie modules that have import
and export
statements of their own). 开箱即用,汇总仅知道如何导入ES模块(即,具有自己的
import
和export
语句的模块)。 Highlight is a CommonJS module rather than an ES module, so you'll need to use a plugin in order to import it – specifically, rollup-plugin-commonjs alongside rollup-plugin-node-resolve . Highlight是一个CommonJS模块而不是一个ES模块,因此您需要使用一个插件才能导入它-具体来说,就是将rollup-plugin-commonjs与rollup-plugin-node-resolve一起使用 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.