Rollup plugin sample

admin

javascript

look up usage inside dev branch of forked `TypeScriptEditor` on my github:
другие самплы
main.js
generateBundle.js
import { createFilter } from '@rollup/pluginutils';

function requireStaticLinking (options = {}) {

    const filter = createFilter(options.include, options.exclude);

    return {
        name: 'rollup-plugin-require-static',
        transform(code, file) {

            if (!filter(file)) return;
            // let source = new MagicString(code)

            code = code.replace('define(function(require, exports, module) {', '').replace(/\}\);/g, (match, offset, _content) => {
                if (_content.length - offset < 7) return '';
                 else {
                     return match;}
            })      

            return { code: code, map: { mappings: '' }};
        }
    };
}
Новый листинг
скачать через терминал: wget https://coding-style.ru/code_reviews/download/367 && mkdir "rollup plugin sample" && unzip 367 -d ./"rollup plugin sample" && rm 367 && cd "rollup plugin sample"" && git init
(ваш голос учтен)

Прикрепить файл