How to use rollup-plugin-typescript2 - 10 common examples

To help you get started, we’ve selected a few rollup-plugin-typescript2 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 codesandbox / codesandbox-client / standalone-packages / react-sandpack / rollup.config.ts View on Github external
isUMD
        ? {
            file: getFileName(pkg.main.replace('.js', '.umd.js')),
            name: camelCase(libraryName),
            format: 'umd',
          }
        : { file: getFileName(pkg.main), format: 'cjs' },
    ],
    sourcemap: true,
    watch: {
      include: 'src/**',
    },
    external: isUMD ? [] : id => id === 'react' || /codemirror/.test(id),
    plugins: [
      // Compile TypeScript files
      typescript({ useTsconfigDeclarationDir: true }),
      // Allow bundling cjs modules (unlike webpack, rollup doesn't understand cjs)
      isUMD && commonjs(),
      // Allow node_modules resolution, so you can use 'external' to control
      // which external modules to include in the bundle
      // https://github.com/rollup/rollup-plugin-node-resolve#usage
      isUMD && resolve(),

      // Resolve source maps to the original source
      sourceMaps(),

      minify && uglify(),
    ],
  };
}
github Zilliqa / Zilliqa-JavaScript-Library / scripts / bundle.ts View on Github external
}),
          resolve({
            browser: true,
            jsnext: true,
            preferBuiltins: true,
          }),
          commonjs({
            namedExports: {
              [path.resolve(__dirname, '../', 'includes/proto/index.js')]: [
                'ZilliqaMessage',
              ],
            },
          }),
          globals(),
          json(),
          typescript2({
            tsconfig: path.join(pkg.path, 'tsconfig.json'),
            typescript: ts, // ensure we're using the same typescript (3.x) for rollup as for regular builds etc
            tsconfigOverride: {
              module: 'esnext',
              stripInternal: true,
              emitDeclarationOnly: false,
              composite: false,
              declaration: false,
              declarationMap: false,
              sourceMap: true,
            },
          }),
        ],
        // mark all packages that are not *this* package as external so they don't get included in the bundle
        // include tslib in the bundles since only __decorate is really used by multiple packages (we can figure out a way to deduplicate that later on if need be)
        external: getKeys(pkg.name),
github tensorflow / tfjs-models / coco-ssd / rollup.config.js View on Github external
function config({plugins = [], output = {}}) {
  return {
    input: 'src/index.ts',
    plugins: [
      typescript({
        tsconfigOverride: {
          compilerOptions: {module: 'ES2015'},
        },
      }),
      node(), ...plugins
    ],
    output: {
      banner: PREAMBLE,
      globals: {
        '@tensorflow/tfjs-core': 'tf',
        '@tensorflow/tfjs-converter': 'tf',
      },
      ...output
    },
    external: [
      '@tensorflow/tfjs-core',
github react-spring / zustand / rollup.config.js View on Github external
function createESMConfig(input, output) {
  return {
    input,
    output: { file: output, format: 'esm' },
    external,
    plugins: [
      typescript(),
      babel(getBabelOptions({ node: 8 })),
      sizeSnapshot(),
      resolve({ extensions }),
    ],
  }
}
github ezolenko / rollup-plugin-typescript2 / rollup.config.js View on Github external
import ts from "rollup-plugin-typescript2";

import config from "./rollup.config.base";

config.plugins.push(ts({ verbosity: 2, abortOnError: false }));

export default config;
github apollographql / space-kit / rollup.config.js View on Github external
"classnames",
      "framer-motion",
      "prop-types",
      "react",
      "tinycolor2",
    ],
    output: [
      {
        dir: ".",
        format: "cjs",
        sourcemap: true,
        entryFileNames: "[name].js",
      },
    ],
    plugins: [
      typescript({
        tsconfig: "tsconfig.build.json",
      }),
      multiInput({
        relative: "src/",
      }),
      postcss({
        extensions: [".css"],
      }),
    ],
  };
}
github handsontable / vue-handsontable-official / .config / base.js View on Github external
import json from 'rollup-plugin-json';
import commonjs from 'rollup-plugin-commonjs';

export const plugins = {
  replace: replace({
    'process.env.NODE_ENV': JSON.stringify('production')
  }),
  VuePlugin: VuePlugin({
    defaultLang: {
      script: 'ts'
    },
    template: {
      isProduction: true
    }
  }),
  typescript: typescript({
    objectHashIgnoreUnknownHack: true,
    clean: true
  }),
  babel: babel({
    babelrc: false,
    exclude: 'node_modules/**',
    extensions: ['.js', '.ts', '.vue'],
    presets: [
      '@babel/env'
    ],
  }),
  nodeResolve: nodeResolve(),
  json: json({
    include: 'package.json',
    compact: true
  }),
github turissinitechnologies / rotoscope / rollup.config.js View on Github external
function rollupConfig(config) {
    const { format, target } = config;
    return {
        input: entry,
        output: {
            file: `${dist}/rotoscope.js`,
            format,
        },
        plugins: [
            typescript({
                clean: true,
                tsconfigOverride: {
                    compilerOptions: {
                        target,
                    },
                },
            }),
        ],
    };
}
github andrewvasilchuk / vue-lazy-youtube-video / build / rollup.config.dev.js View on Github external
import typescriptPluginOptions from './base/plugins/typescript'
import plugins from './base/plugins/index'

const DEMO_DIR = path.join(__dirname, '../demo')

/** @type {import('rollup').RollupOptions} */
export default {
  input: path.join(DEMO_DIR, 'index.ts'),
  output: {
    file: path.join(DEMO_DIR, 'demo.js'),
    format: 'iife',
    name: 'demo',
    sourcemap: true,
  },
  plugins: [
    typescript(typescriptPluginOptions),
    vue(),
    replace({
      'process.env.NODE_ENV': JSON.stringify('development'),
    }),
    serve({
      open: true,
      contentBase: DEMO_DIR,
      port: 8080,
    }),
    livereload({
      verbose: true,
      watch: DEMO_DIR,
    }),
  ].concat(plugins),
}
github ashleyw / react-sane-contenteditable / rollup.config.js View on Github external
const external = Object.keys(common.output.globals);

export default [
  {
    input: common.input,
    output: {
      file: 'dist/index.umd.js',
      format: 'umd',
      name: common.output.name,
      globals: common.output.globals,
    },
    external,
    plugins: [
      resolve(common.plugins.resolve),
      commonjs(common.plugins.commonJs),
      typescript(common.plugins.typescript),
      babel(common.plugins.babel),
      replace({
        'process.env.NODE_ENV': JSON.stringify('development'),
      }),
      sizeSnapshot(),
    ],
  },
  {
    input: common.input,
    output: {
      file: 'dist/index.umd.min.js',
      format: 'umd',
      globals: common.output.globals,
      name: common.output.name,
    },
    external,

rollup-plugin-typescript2

Seamless integration between Rollup and TypeScript. Now with errors.

MIT
Latest version published 1 year ago

Package Health Score

71 / 100
Full package analysis

Popular rollup-plugin-typescript2 functions