简体   繁体   English

如何使用汇总导入内容

[英]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. 汇总后, domEventparentScope对象将包含在我文件的顶部。

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模块(即,具有自己的importexport语句的模块)。 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-commonjsrollup-plugin-node-resolve一起使用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM