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

To help you get started, we’ve selected a few rollup-plugin-sourcemaps 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 ianstormtaylor / slate / support / rollup / examples.js View on Github external
// Register Node.js builtins for browserify compatibility.
      builtins(),

      // Use Babel to transpile the result, limiting it to the source code.
      babel({
        include: ['examples/**'],
      }),

      // Register Node.js globals for browserify compatibility.
      globals(),

      // Only minify the output in production, since it is very slow.
      isProd && uglify(),

      // Only parse sourcemaps of dependencies in development.
      isDev && sourcemaps(),
    ].filter(Boolean),
  }
}
github Azure / azure-sdk-for-js / sdk / eventhub / eventhubs-checkpointstore-blob / rollup.base.config.js View on Github external
export function nodeConfig(test = false) {
  const externalNodeBuiltins = ["events", "util", "os"];
  const baseConfig = {
    input: input,
    external: depNames.concat(externalNodeBuiltins),
    output: { file: "dist/index.js", format: "cjs", sourcemap: true },
    preserveSymlinks: false,
    plugins: [
      sourcemaps(),
      replace({
        delimiters: ["", ""],
        values: {
          // replace dynamic checks with if (true) since this is for node only.
          // Allows rollup's dead code elimination to be more aggressive.
          "if (isNode)": "if (true)"
        }
      }),
      nodeResolve({ preferBuiltins: true }),
      cjs(),
      json()
    ]
  };

  baseConfig.external.push("crypto");
github Azure / azure-sdk-for-js / sdk / keyvault / keyvault-certificates / rollup.base.config.js View on Github external
export function nodeConfig(test = false) {
  const externalNodeBuiltins = ["crypto", "fs", "os", "url", "assert"];
  const baseConfig = {
    input: "dist-esm/src/index.js",
    external: depNames.concat(externalNodeBuiltins),
    output: {
      file: "dist/index.js",
      format: "cjs",
      name: "azurekeyvaultcertificates",
      sourcemap: true,
      banner: banner
    },
    plugins: [
      sourcemaps(),
      replace({
        delimiters: ["", ""],
        values: {
          // replace dynamic checks with if (true) since this is for node only.
          // Allows rollup's dead code elimination to be more aggressive.
          "if (isNode)": ";isNode; if (true)"
        }
      }),
      nodeResolve({ preferBuiltins: true }),
      cjs()
    ]
  };

  if (test) {
    // entry point is every test file
    baseConfig.input = ["dist-esm/test/*.test.js"];
github Azure / azure-sdk-for-js / sdk / eventhub / event-processor-host / rollup.base.config.js View on Github external
export function browserConfig(test = false) {
  const baseConfig = {
    input: input,
    external: ["ms-rest-js"],
    output: {
      file: "browser/index.js",
      format: "umd",
      name: "ExampleClient",
      sourcemap: true,
      globals: { "ms-rest-js": "msRest" }
    },
    preserveSymlinks: false,
    plugins: [
      sourcemaps(),
      replace(
        // ms-rest-js is externalized so users must include it prior to using this bundle.
        {
          delimiters: ["", ""],
          values: {
            // replace dynamic checks with if (false) since this is for
            // browser only. Rollup's dead code elimination will remove
            // any code guarded by if (isNode) { ... }
            "if (isNode)": "if (false)"
          }
        }
      ),
      nodeResolve({
        mainFields: ["module", "browser"],
        preferBuiltins: false
      }),
github Azure / azure-sdk-for-js / sdk / eventhub / event-processor-host / rollup.base.config.js View on Github external
export function nodeConfig(test = false) {
  const externalNodeBuiltins = ["events", "util"];
  const baseConfig = {
    input: input,
    external: depNames.concat(externalNodeBuiltins),
    output: { file: "dist/index.js", format: "cjs", sourcemap: true },
    preserveSymlinks: false,
    plugins: [
      sourcemaps(),
      replace({
        delimiters: ["", ""],
        values: {
          // replace dynamic checks with if (true) since this is for node only.
          // Allows rollup's dead code elimination to be more aggressive.
          "if (isNode)": "if (true)"
        }
      }),
      nodeResolve({ preferBuiltins: true }),
      cjs(),
      json()
    ]
  };

  baseConfig.external.push("crypto", "path");
github Pong420 / videojs-plus / rollup.config.js View on Github external
json(),
      // Compile TypeScript files
      // Allow bundling cjs modules (unlike webpack, rollup doesn't understand cjs)
      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
      resolve(),
      babel({
        babelrc: true,
        exclude: 'node_modules/**',
        compact: false
      }),

      // Resolve source maps to the original source
      sourceMaps(),
      scss({
        output: styles => {
          if (styles && styles.length) {
            const cssOutput = css || output[0].file.replace(/\.(umd|es|iife).js/, '.css');
            mkdirp(cssOutput.replace(/[^\/]*$/, ''));
            fs.writeFileSync(cssOutput, styles);
          }
        }
      }),
      ...plugins
    ]
  };
}
github Azure / azure-sdk-for-js / sdk / servicebus / service-bus / rollup.base.config.js View on Github external
export function nodeConfig({ test = false, production = false } = {}) {
  const externalNodeBuiltins = ["events", "util", "os"];
  const baseConfig = {
    input: input,
    external: depNames.concat(externalNodeBuiltins),
    output: { file: "dist/index.js", format: "cjs", sourcemap: true },
    preserveSymlinks: false,
    plugins: [
      sourcemaps(),
      replace({
        delimiters: ["", ""],
        values: {
          // replace dynamic checks with if (true) since this is for node only.
          // Allows rollup's dead code elimination to be more aggressive.
          "if (isNode)": "if (true)",
          "if (!isNode)": "if (false)"
        }
      }),
      nodeResolve({ preferBuiltins: true }),
      cjs(),
      json()
    ]
  };

  if (test) {
github Azure / azure-sdk-for-js / sdk / eventhub / event-hubs / rollup.base.config.js View on Github external
export function browserConfig(test = false) {
  const baseConfig = {
    input: input,
    external: ["ms-rest-js"],
    output: {
      file: "browser/event-hubs.js",
      format: "umd",
      name: "Azure.Messaging.EventHubs",
      sourcemap: true,
      globals: { "ms-rest-js": "msRest" }
    },
    preserveSymlinks: false,
    plugins: [
      sourcemaps(),
      replace(
        // ms-rest-js is externalized so users must include it prior to using this bundle.
        {
          delimiters: ["", ""],
          values: {
            // replace dynamic checks with if (false) since this is for
            // browser only. Rollup's dead code elimination will remove
            // any code guarded by if (isNode) { ... }
            "if (isNode)": "if (false)"
          }
        }
      ),

      // fs, net, and tls are used by rhea and need to be shimmed
      // dotenv doesn't work in the browser, so replace it with a no-op function
      shim({
github osdevisnot / klap / src / plugins.js View on Github external
const plugins = (command, pkg, options) => {
  const { extensions, presets, plugins } = babelConfig(command, pkg, options);
  const { sourcemap, minify, fallback, port, namedExports, closure } = options;

  const babelDefaults = { babelrc: false, configFile: false, compact: false };

  return [
    sourcemap && sourcemaps(),
    json(),
    nodeGlobals(),
    nodeResolve({
      mainFields: ['module', 'jsnext:main', 'browser', 'main'],
      extensions,
    }),
    commonjs({ extensions, include: /\/node_modules\//, namedExports }),
    babel({
      ...babelDefaults,
      exclude: 'node_modules/**',
      extensions,
      presets,
      plugins,
    }),
    replace({ 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV) }),
    command !== 'start' &&
github kettanaito / atomic-layout / packages / atomic-layout / rollup.config.js View on Github external
external,
  output: {
    file: getPath(packageJson.module),
    format: 'esm',
    sourcemap: PRODUCTION,
  },
  plugins: [
    resolve({
      mainFields: ['esnext'],
    }),
    replace({
      __PROD__,
    }),
    typescript(),
    babel(),
    PRODUCTION && sourceMaps(),
  ],
})

rollup-plugin-sourcemaps

Rollup plugin for grabbing source maps from sourceMappingURLs

MIT
Latest version published 4 years ago

Package Health Score

53 / 100
Full package analysis

Popular rollup-plugin-sourcemaps functions