@kalxjs/compiler-plugin
Version:
Webpack and Rollup plugin for KalxJS single-file components
75 lines (60 loc) • 1.34 kB
Markdown
Webpack and Rollup plugin for KalxJS single-file components.
```bash
npm install --save-dev @kalxjs/compiler-plugin
```
```javascript
// webpack.config.js
const { WebpackPlugin } = require('@kalxjs/compiler-plugin');
module.exports = {
// ...
module: {
rules: [
{
test: /\.klx$/,
use: [
'babel-loader',
{
loader: require.resolve('@kalxjs/compiler-plugin/loader'),
options: {
// compiler options
}
}
]
}
]
},
plugins: [
new WebpackPlugin({
// plugin options
})
]
};
```
```javascript
// rollup.config.js
import { rollupPlugin } from '@kalxjs/compiler-plugin';
export default {
// ...
plugins: [
rollupPlugin({
// plugin options
})
]
};
```
- `sourceMap` - Generate source maps (default: `false`)
- `hot` - Enable hot module replacement (default: `false`)
- `optimize` - Enable optimizations (default: `process.env.NODE_ENV === 'production'`)
## Features
- Compiles KalxJS single-file components (`.klx` files)
- Supports both Webpack and Rollup
- Integrates with Babel for transpilation
- Supports source maps
- Supports hot module replacement
## License
MIT