How to use @rollup/plugin-alias - 8 common examples

To help you get started, we’ve selected a few @rollup/plugin-alias 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 algolia / algoliasearch-client-javascript / rollup.config.js View on Github external
}),
          ignore(packageConfig.ignore || []),
          ts({
            check: !hasTSChecked,
            tsconfig: path.resolve(__dirname, 'tsconfig.json'),
            cacheRoot: path.resolve(__dirname, 'node_modules/.rts2_cache'),
            tsconfigOverride: {
              include: ['packages/**/src/**/*.ts'],
              exclude: ['packages/**/src/__tests__/**/*.ts'],
              compilerOptions: {
                declaration: !hasTSChecked,
                declarationMap: !hasTSChecked,
              },
            },
          }),
          alias(aliasOptions),
          ...transpilerPlugins,
          ...compressorPlugins,
          filesize({
            showMinifiedSize: false,
            showGzippedSize: true,
          }),
        ],
        output,
        onwarn(msg, warn) {
          if (!/Circular/.test(msg)) {
            warn(msg);
          }
        },
      });

      // We just generate TS declarations once for each package.
github vuejs / vuefire / rollup.config.js View on Github external
env: 'development',
    minify: false,
    isBrowser: false,
  }
) {
  // force production mode when minifying
  if (minify) env = 'production'

  const config = {
    input,
    plugins: [
      replace({
        __VERSION__: pkg.version,
        'process.env.NODE_ENV': `'${env}'`,
      }),
      alias({
        resolve: ['.ts', '.js'],
        entries: [{ find: 'firebase', replacement: path.join(__dirname, './stub') }],
      }),
    ],
    output: {
      banner,
      file: `dist/${pkg.name}.UNKNOWN.js`,
      format,
    },
  }

  if (format === 'iife') {
    config.output.file = pkg.unpkg
    config.output.name = exportName
  } else if (format === 'es') {
    config.output.file = isBrowser ? pkg.browser : pkg.module
github rei / rei-cedar / build / rollup-plugins.js View on Github external
let copyTargets = [''];
let copyOutput = 'public';

// prod only options
if (env === 'prod') {
  postcssExtract = 'dist/cedar-compiled.css';
  copyOutput = 'dist';
}

// dev and prod options
if (env !== 'test') {
  copyTargets = ['static/cdr-fonts.css'];
}

const plugins = [
  (env == 'test' || env == 'dev') && alias({
    resolve: ['.json', '.js', '.jsx', '.scss', '.vue'],
    entries: {
      srcdir: resolve('src'),
      cssdir: resolve('src/css'),
      assetsdir: resolve('src/assets'),
      componentsdir: resolve('src/components'),
      mixinsdir: resolve('src/mixins'),
    },
  }),
  nodeResolve({
    mainFields: ['module', 'jsnext:main', 'main'],
    extensions: ['.mjs', '.js', '.jsx', '.json'],
  }),
  env !== 'prod' &&  vue({
    style: {
      postcssModulesOptions: {
github preconstruct / preconstruct / packages / cli / src / build / rollup.ts View on Github external
type === "umd" &&
        cjs({
          include: ["**/node_modules/**", "node_modules/**"]
        }),
      (type === "browser" || type === "umd") &&
        replace({
          ["typeof " + "document"]: JSON.stringify("object"),
          ["typeof " + "window"]: JSON.stringify("object")
        }),
      rewriteBabelRuntimeHelpers(),
      json({
        // @ts-ignore
        namedExports: false
      }),
      type === "umd" &&
        alias({
          entries: rollupAliases
        }),
      resolve({
        extensions: EXTENSIONS,
        customResolveOptions: {
          moduleDirectory: type === "umd" ? "node_modules" : []
        }
      }),
      (type === "umd" || type === "node-prod") &&
        replace({
          // tricking static analysis is fun...
          ["process" + ".env.NODE_ENV"]: '"production"'
        }),
      type === "umd" && terser(),
      type === "node-prod" &&
        terser({
github posva / pinia / rollup.config.js View on Github external
input = 'src/index.ts', // entry point
  env = 'development', // NODE_ENV variable
  minify = false,
  isBrowser = false, // produce a browser module version or not
}) {
  // force production mode when minifying
  if (minify) env = 'production'

  const config = {
    input,
    plugins: [
      replace({
        __VERSION__: pkg.version,
        'process.env.NODE_ENV': `'${env}'`,
      }),
      alias({
        resolve: ['.ts', '.js'],
        // entries: [{ find: 'firebase', replacement: path.join(__dirname, './stub') }],
      }),
    ],
    output: {
      banner,
      file: `dist/${pkg.name}.UNKNOWN.js`,
      format,

      globals: {
        '@vue/composition-api': 'VueCompositionApi',
      },
    },
  }

  if (format === 'iife') {
github jledentu / vue-finder / rollup.config.js View on Github external
function genConfig(name) {
  const opts = builds[name];
  const config = {
    input: opts.entry,
    external: ["vue"],
    plugins: [
      css({
        output: "dist/vue-finder.css"
      }),
      vue({ compileTemplate: true, css: false }),
      alias({
        entries: [
          {
            find: "@",
            replacement: path.resolve("src")
          }
        ]
      }),
      resolve({
        browser: true,
        preferBuiltins: false,
        extensions: [".js", ".json", ".vue"]
      }),
      json(),
      babel({
        exclude: "node_modules/**",
        sourceMap: true,
github tracking-exposed / web-extension / rollup.config.js View on Github external
function setAlias() {
  const projectRootDir = path.resolve(__dirname);
  return alias({
    resolve: [".svelte", ".js"],
    entries: [
      {
        find: "src",
        replacement: path.resolve(projectRootDir, "src")
      }
    ]
  });
}
github gpbl / react-day-picker / package / rollup.config.js View on Github external
import { terser } from "rollup-plugin-terser";
import typescript from "rollup-plugin-typescript2";
import path from "path";
import pkg from "./package.json";

const name = "ReactDayPicker";
const input = "./src/index.ts";
const globals = { react: "React" };
const external = Object.keys(globals);

const typescriptPlugin = typescript({
  rollupCommonJSResolveHack: true,
  clean: true,
  verbosity: 2
});
const aliasPlugin = alias({
  resolve: ["*.ts", "*.tsx"],
  entries: {
    components: path.resolve("./src/components")
  }
});
const replaceProduction = replace({
  "process.env.NODE_ENV": JSON.stringify("production")
});

export default [
  {
    input,
    output: {
      file: "lib/index.umd.js",
      format: "umd",
      name,

@rollup/plugin-alias

Define and resolve aliases for bundle dependencies

MIT
Latest version published 3 months ago

Package Health Score

100 / 100
Full package analysis

Popular @rollup/plugin-alias functions