Skip to content

Zhuoqing/rollupClipboard

Repository files navigation

repro repo is at https://github.com/Zhuoqing/rollupClipboard for issue rollup/rollup-plugin-commonjs#157

The typings for @types/[email protected] is something like

declare class Clipboard {...
}

declare namespace Clipboard {...
}

export = Clipboard;
export as namespace Clipboard;

and its usage example is like

import * as Clipboard from 'clipboard';
var cb1 = new Clipboard('.btn');

However when we try to bundle with rollup with same syntax, somehow new Clipboard doesn't work and we had to do new Clipboard.default which doesn't seem right. #to repro npm i && npm run build, then load index.html and watch the error in console, can also check jsfiddle here

Note if change to use import Clipboard from 'clipboard'; it works. However in our repo ngc/tsc will complain module has no default export, not sure what magic rollup-plugin-typescript is doing there. Also looks like import Clipboard = require('clipboard'); doesn't work because of es2015 module.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published