Guest User

Untitled

a guest
Dec 15th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. import typescript from 'rollup-plugin-typescript2';
  2. import { terser } from "rollup-plugin-terser";
  3. import { sizeSnapshot } from "rollup-plugin-size-snapshot";
  4. import resolve from 'rollup-plugin-node-resolve';
  5. import commonjs from 'rollup-plugin-commonjs';
  6.  
  7. import * as globby from "globby";
  8.  
  9. const globbedConfigs = globby.sync('src/patterns/**/*.ts').map(inputFile => {
  10. const filename = inputFile.split("/")[inputFile.split("/").length-1];
  11. return {
  12. input: inputFile,
  13. output: {
  14. dir: './public/js/',
  15. format: 'iife',
  16. file: filename.replace(".ts", ".min.js"),
  17. name: filename.replace(".ts", ""),
  18. },
  19. plugins: [
  20. resolve(),
  21. commonjs(),
  22. typescript(),
  23. sizeSnapshot(),
  24. terser()
  25. ]
  26. };
  27. });
  28. export default [...globbedConfigs,{
  29. input: './src/scripts/main.ts',
  30. output: [{
  31. format: 'iife',
  32. dir: './public/js/',
  33. file: 'main.browser.js',
  34. name: 'com.compassion',
  35. sourcemap: true,
  36. }],
  37. plugins: [
  38. resolve(),
  39. commonjs(),
  40. typescript(/*{ plugin options }*/),
  41. sizeSnapshot(),
  42.  
  43. ]
  44. },{
  45. input: './src/scripts/main.ts',
  46. output: [{
  47. format: 'iife',
  48. dir: './public/js/',
  49. file: 'main.browser.min.js',
  50. name: 'com.compassion',
  51. }],
  52. plugins: [
  53. resolve(),
  54. commonjs(),
  55. typescript(/*{ plugin options }*/),
  56. sizeSnapshot(),
  57. terser()
  58. ]
  59. },{
  60. input: './src/scripts/main.ts',
  61. output: {
  62. format: "es",
  63. dir: "./dist/js/",
  64. file: "main.module.js",
  65. sourcemap: true,
  66. },
  67. plugins: [
  68. resolve({
  69. browser: true,
  70. }),
  71. commonjs(),
  72. typescript(/*{ plugin options }*/),
  73. sizeSnapshot(),
  74. ]
  75. }];
Add Comment
Please, Sign In to add comment