@closure-next/rollup
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

Closure Next Rollup Plugin

Rollup integration for Closure Next, providing efficient bundling and code splitting.

Installation

npm install @closure-next/rollup

Usage

// rollup.config.js
import { closureNextRollup } from '@closure-next/rollup';

export default {
  input: 'src/index.ts',
  plugins: [
    closureNextRollup({
      codeSplitting: true,
      paths: {
        // Custom module resolution
      }
    })
  ]
};

Features

  • 🔌 Plug-and-play integration
  • 📦 Automatic code splitting
  • 🗺️ Custom module resolution
  • 🔧 TypeScript support
  • ⚡️ Efficient bundling
  • 🛠️ Development tools

Options

codeSplitting

Enable code splitting for Closure components.

closureNextRollup({
  codeSplitting: true
})

paths

Configure custom module resolution paths.

closureNextRollup({
  paths: {
    '@components': './src/components'
  }
})

Example Configuration

Development Mode

// rollup.config.js
import { closureNextRollup } from '@closure-next/rollup';
import typescript from '@rollup/plugin-typescript';

export default {
  input: 'src/index.ts',
  output: {
    dir: 'dist',
    format: 'esm',
    sourcemap: true
  },
  plugins: [
    typescript(),
    closureNextRollup({
      codeSplitting: true,
      paths: {
        '@closure-next': './node_modules/@closure-next'
      }
    })
  ]
};

Production Mode

// rollup.config.js
import { closureNextRollup } from '@closure-next/rollup';
import typescript from '@rollup/plugin-typescript';
import terser from '@rollup/plugin-terser';

export default {
  input: 'src/index.ts',
  output: {
    dir: 'dist',
    format: 'esm',
    sourcemap: false
  },
  plugins: [
    typescript(),
    closureNextRollup({
      codeSplitting: true
    }),
    terser()
  ]
};

TypeScript Support

The plugin includes TypeScript definitions:

import { closureNextRollup } from '@closure-next/rollup';
import type { RollupOptions } from 'rollup';

const config: RollupOptions = {
  plugins: [
    closureNextRollup({
      // Type-checked options
    })
  ]
};

Code Splitting

The plugin automatically handles code splitting for Closure components:

// Your code
import { Component } from '@closure-next/core';

// Dynamic imports are automatically code-split
const MyComponent = await import('./components/MyComponent');

Module Resolution

Custom module resolution paths can be configured:

closureNextRollup({
  paths: {
    '@components': './src/components',
    '@utils': './src/utils'
  }
})

This allows imports like:

import { MyComponent } from '@components/MyComponent';
import { utils } from '@utils/index';

Development Tools

The plugin supports various development features:

  • Source maps for debugging
  • Watch mode
  • Fast builds
  • Tree shaking
  • Asset handling

Production Optimization

The plugin automatically configures production optimizations:

  • Code splitting
  • Tree shaking
  • Dead code elimination
  • Module concatenation

Package Sidebar

Install

npm i @closure-next/rollup

Weekly Downloads

2

Version

1.1.0

License

Apache-2.0

Unpacked Size

15.2 kB

Total Files

11

Last publish

Collaborators

  • milesonerd