简体   繁体   中英

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:

import { domEvent, parentScope } from 'riot-mixin-pack'

When rolled up the domEvent and parentScope objects are included at the top of my file.

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.

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). 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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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