build-utils.js 562 B

12345678910111213141516171819202122
  1. const rollup = require( 'rollup' ).rollup;
  2. const esbuild = require( 'rollup-plugin-esbuild' ).default;
  3. const name = 'splide-utils';
  4. function buildModule( type ) {
  5. return rollup( {
  6. input: './src/js/utils/index.ts',
  7. plugins: [
  8. esbuild(),
  9. ],
  10. } ).then( bundle => {
  11. return bundle.write( {
  12. file : `./dist/js/utils/${ name }.${ type }.js`,
  13. format : type,
  14. sourcemap: false,
  15. exports : 'named',
  16. } );
  17. } );
  18. }
  19. Promise.all( [ buildModule( 'cjs' ), buildModule( 'esm' ) ] ).catch( e => console.error( e ) );