How to use rollup-plugin-copy - 9 common examples

To help you get started, we’ve selected a few rollup-plugin-copy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github icebob / fastest-validator / rollup.config.js View on Github external
import commonjs from "rollup-plugin-commonjs";
import buble from "rollup-plugin-buble";
import closure from "rollup-plugin-closure-compiler-js";
import uglify from "rollup-plugin-uglify-es";
import pkg from "./package.json";
import copy from "rollup-plugin-copy";

const BUNDLE_NAME = "FastestValidator";

// transpile ES2015+ to ES5
const bublePlugin = buble({
	exclude: ["node_modules/**", "examples/**", "dist/**", "test/**", "benchmark/**"]
});

// copy typescript definitions
const copyPlugin = copy({
	targets: [
		{ src: "index.d.ts", dest: "dist" },
	],
	verbose: true,
	copyOnce: true,
});

const bundles = [
	// UMD Dev
	{
		input: "index.js",
		output: {
			file: "dist/index.js",
			format: "umd",
			name: BUNDLE_NAME,
			sourcemap: true
github spacemeowx2 / DouyuHTML5Player / build / rollup.config.js View on Github external
function plugins() {
  return [
    ...commonPlugins,
    copy({
      'src/option.html': 'dist/html/option.html',
      'src/flash/builtin.abc': 'dist/builtin.abc',
      'src/flash/playerglobal.abc': 'dist/playerglobal.abc',
      'src/flash/douyu.swf': 'dist/douyu.swf',
      'node_modules/vue/dist/vue.runtime.js': 'dist/js/vue.js',
      'node_modules/vuex/dist/vuex.js': 'dist/js/vuex.js',
      'node_modules/flv.js/dist/flv.min.js': 'dist/js/flv.min.js',
      // 'node_modules/flash-emu/dist/flashemu.js': 'dist/js/flashemu.js',
      'src/flash/flashemu.js': 'dist/js/flashemu.js',
      verbose: true
    }),
  ]
}
function background () {
github andreasbm / web-config / ___rollup.config.js View on Github external
}),

		// Teaches Rollup how to transpile code by looking at the .babelrc config
		// Documentation: https://babeljs.io/docs/en/index.html
		babel({
			exclude: "**/node_modules/**",
			runtimeHelpers: true,
			externalHelpers: true,
			extensions: [".ts", ".js"]
		}),

		// Trying to get it to work..
		builtins(),

		// Copies resources to the dist folder
		copy([
			[folders.src_assets, folders.dist_assets]
		].reduce((acc, [from, to]) => {
			acc[from] = to;
			return acc;
		}, {})),

		// Creates a HTML template with the injected scripts from the entry points
		htmlTemplate({
			template: files.src_index,
			target: files.dist_index,
			include: /main-.*\.js$/
		}),

		// Serve
		...(isServe ? [
github wellyshen / react-cool-img / rollup / config.js View on Github external
}),
  !isLib && url(),
  !isLib && postcss({ extract: true, sourceMap: isDev, minimize: !isDev }),
  !isLib && html({ template }),
  !isLib &&
    copy({
      targets: [
        { src: 'src/static/example_assets', dest: 'src/.dev', rename: 'assets' }
      ]
    }),
  isDev && serve('src/.dev'),
  isDev && livereload(),
  !isDev && terser(),
  !isDev && filesize(),
  isExample &&
    copy({
      targets: [{ src: 'src/.dev', dest: '.', rename: 'example' }],
      hook: 'writeBundle'
    }),
  isLib &&
    copy({
      targets: [
        {
          src: 'src/types/react-cool-img.d.ts',
          dest: pkg.types.split('/')[0],
          rename: 'index.d.ts'
        }
      ]
    })
];

export default {
github preactjs / preact-devtools / rollup.config.js View on Github external
input: data.entry,
	output: {
		file: data.dist,
		name: "index.js",
		format: "iife",
	},
	external: data.external || [],
	plugins: [
		typescript({
			cacheRoot: "./node_modules/.cache/rts2",
			objectHashIgnoreUnknownHack: true,
		}),
		resolve(),
		commonjs(),
		data.copy &&
			copy({
				targets: Object.keys(data.copy).map(x => ({
					src: x,
					dest: data.copy[x],
				})),
			}),
		postcss({
			modules: true,
			extract: true,
		}),
	].filter(Boolean),
}));
github Lemaf / leaflet-polyline-segment-edit / rollup.config.js View on Github external
format: 'umd',
        indent: false,
        file
    },
    plugins
});

const copyConfig = {
    targets: [
        {src: 'leaflet.segmentedit.min.js', dest: 'docs'}
    ]
};

export default [
    output('leaflet.segmentedit.js', [resolve(), buble()]),
    output('leaflet.segmentedit.min.js', [resolve(), buble(), terser(), copy(copyConfig)])
];
github remaxjs / remax / packages / remax-cli / src / build / rollupConfig.ts View on Github external
const envReplacement: Env = {
    NODE_ENV: process.env.NODE_ENV || 'development',
    REMAX_PLATFORM: argv.target,
    REMAX_DEBUG: process.env.REMAX_DEBUG,
    REMAX_PX2RPX: `${options.pxToRpx}`,
  };

  Object.keys(process.env).forEach(k => {
    if (k.startsWith('REMAX_APP_')) {
      envReplacement[`${k}`] = process.env[k];
    }
  });

  const plugins = [
    copy({
      targets: [
        {
          src: [`${options.rootDir}/native/*`],
          dest: options.output,
        },
      ],
      copyOnce: true,
    }),
    alias(options),
    url({
      limit: 0,
      fileName: '[dirname][name][extname]',
      publicPath: '/',
      sourceDir: path.resolve(options.cwd, options.rootDir),
      include: ['**/*.svg', '**/*.png', '**/*.jpg', '**/*.jpeg', '**/*.gif'],
    }),
github stuartjnelson / badger-accordion / rollup.config.js View on Github external
sourcemap: 'false',
    name: 'BadgerAccordion',
    output: output,
    plugins: [
        resolve(),
        commonjs(),
        eslint({
            exclude: ['src/css/**', 'src/scss/**']
        }),
        babel({exclude: 'node_modules/**'}),
        includePaths(),
        replace({
            ENV: JSON.stringify(process.env.NODE_ENV || 'development'),
        }),
        (process.env.NODE_ENV === 'example' &&
            copy({
                'src/css/badger-accordion.css' : 'example/css/badger-accordion.css',
                'src/scss/badger-accordion.scss' : 'example/scss/badger-accordion.scss'
            })
        ),
        (process.env.NODE_ENV === 'production' && uglify()),
        (process.env.NODE_ENV === 'production' &&
            copy({
                'src/js/array-from-polyfill.js' : 'dist/array-from-polyfill.js',
                'src/css/badger-accordion.css' : 'dist/badger-accordion.css',
                'src/scss/badger-accordion.scss' : 'dist/badger-accordion.scss'
            })
        )
    ]
};
github vue-gl / vue-gl / docs / rollup.config.js View on Github external
import path from 'path';
import copy from 'rollup-plugin-copy';
import generateComponentDocuments from './rollup-plugins/rollup-plugin-generate-component-documents';
import configArray from '../rollup.config';

const [config] = configArray;

Object.assign(config.output, {
  file: path.resolve(__dirname, 'js/vue-gl.js'),
});

config.plugins.push(
  copy({
    targets: [{
      src: require.resolve('vue/dist/vue.min'),
      dest: path.resolve(__dirname, 'js'),
    }, {
      src: require.resolve('three/build/three.min'),
      dest: path.resolve(__dirname, 'js'),
    }, {
      src: require.resolve('three/examples/fonts/helvetiker_regular.typeface.json'),
      dest: path.resolve(__dirname, 'js'),
    }],
  }),
  generateComponentDocuments({
    src: path.resolve(__dirname, '../src'),
    dest: path.resolve(__dirname, 'components'),
  }),
);

rollup-plugin-copy

Copy files and folders using Rollup

MIT
Latest version published 1 year ago

Package Health Score

59 / 100
Full package analysis

Popular rollup-plugin-copy functions