uikit/rollup.config.js

70 lines
2.0 KiB
JavaScript
Raw Permalink Normal View History

2020-09-04 17:45:23 +00:00
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import { babel } from '@rollup/plugin-babel';
import { terser } from 'rollup-plugin-terser';
import license from 'rollup-plugin-license';
import replace from '@rollup/plugin-replace';
const licenseLine = {
banner: `/*! VDM Uikit v${require('./package.json').version} | https://git.vdm.dev/joomla/uikit | (c) 2020 - ${new Date().getFullYear()} Llewellyn van der Merwe | MIT License */`
2020-09-04 17:45:23 +00:00
};
const licenseHeader = {
banner: `/**
* VDM Uikit v${require('./package.json').version}
2020-09-04 17:45:23 +00:00
* https://git.vdm.dev/joomla/uikit
* (c) 2020 - ${new Date().getFullYear()} Llewellyn van der Merwe
* MIT License
**/
`};
export default [
{
input: 'src/js/vdm.js',
2020-09-04 17:45:23 +00:00
plugins: [
license(licenseHeader),
replace({
'process.env.DEBUG': true,
preventAssignment: true,
}),
resolve(), // Resolves local and node modules
commonjs()
],
output: {
file: 'dist/js/vdm.js',
2020-09-04 17:45:23 +00:00
format: 'iife',
name: 'VDMUikit',
2020-09-04 17:45:23 +00:00
globals: {
uikit: 'UIkit'
2020-09-04 17:45:23 +00:00
}
},
external: ['uikit'], // UIkit is treated as external
},
{
input: 'src/js/vdm.js',
2020-09-04 17:45:23 +00:00
plugins: [
resolve(), // Resolves local and node modules
commonjs(),
babel({
babelHelpers: 'bundled',
presets: ['@babel/preset-env'],
}),
terser(), // Minify the output
license(licenseLine),
replace({
'process.env.DEBUG': false,
preventAssignment: true,
})
],
external: ['uikit'], // UIkit is treated as external
output: {
file: 'dist/js/vdm.min.js',
2020-09-04 17:45:23 +00:00
format: 'iife',
name: 'VDMUikit',
2020-09-04 17:45:23 +00:00
globals: {
uikit: 'UIkit'
2020-09-04 17:45:23 +00:00
},
},
},
];