nl_tokens: Rollup removes local variables unless used within a module . This plugin makes sure specified local variables are preserved and kept local . This plugin wouldn t be necessary if es2015 modules would be used .
pl_tokens: function rawjs ( opts ) { opts = opts || { } return { <mask> : ( code , id ) => { var variable = opts [ id . split ( '/' ) . pop ( ) ] if ( ! variable ) return code var keepStr = '/*rollup-keeper-start*/window.tmp=' + variable + ';/*rollup-keeper-end*/' return code + keepStr } , transformBundle : ( code ) => { for ( var file in opts ) { var r = new RegExp ( opts [ file ] + '\\$\\d+' , 'g' ) code = code . replace ( r , opts [ file ] ) } var re = / \/\*rollup-keeper-start\*\/.*\/\*rollup-keeper-end\*\/ / g return code . replace ( re , '' ) } } }