Package Exports
- @closure-next/rollup
- @closure-next/rollup/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@closure-next/rollup) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Closure Next Rollup Plugin
Rollup integration for Closure Next, providing efficient bundling and code splitting.
Installation
npm install @closure-next/rollupUsage
// 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