選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 

95 行
2.0 KiB

  1. import json from 'rollup-plugin-json';
  2. import uglify from 'rollup-plugin-uglify-es';
  3. import nodeResolve from 'rollup-plugin-node-resolve';
  4. import commonjs from 'rollup-plugin-commonjs';
  5. import postcss from 'rollup-plugin-postcss';
  6. import nested from 'postcss-nested';
  7. import customProperties from 'postcss-custom-properties';
  8. import autoprefixer from 'autoprefixer';
  9. import eslint from 'rollup-plugin-eslint';
  10. import merge from 'deepmerge';
  11. const production = process.env.NODE_ENV === 'production';
  12. const baseJS = {
  13. input: 'src/index.js',
  14. output: {
  15. file: '',
  16. globals: {
  17. sortablejs: 'Sortable',
  18. 'clusterize.js': 'Clusterize'
  19. }
  20. },
  21. plugins: [
  22. json(),
  23. eslint({
  24. exclude: '**/*.json'
  25. }),
  26. nodeResolve(),
  27. commonjs()
  28. ],
  29. external: ['sortablejs', 'clusterize.js']
  30. };
  31. const baseCSS = {
  32. input: 'src/style.css',
  33. output: {
  34. file: ''
  35. },
  36. plugins: [
  37. postcss({
  38. extract: true,
  39. minimize: production,
  40. plugins: [
  41. customProperties(),
  42. nested(),
  43. autoprefixer()
  44. ]
  45. })
  46. ]
  47. };
  48. const devIIFE = merge(baseJS, {
  49. output: {
  50. file: 'dist/xhiveframework-datatable.js',
  51. format: 'iife',
  52. name: 'DataTable'
  53. }
  54. });
  55. const devCjs = merge(baseJS, {
  56. output: {
  57. file: 'dist/xhiveframework-datatable.cjs.js',
  58. format: 'cjs'
  59. }
  60. });
  61. const devCSS = merge(baseCSS, {
  62. output: {
  63. file: 'dist/xhiveframework-datatable.css',
  64. format: 'cjs'
  65. }
  66. });
  67. // production
  68. const prodIIFE = merge(devIIFE, {
  69. output: {
  70. file: 'dist/xhiveframework-datatable.min.js'
  71. },
  72. plugins: [
  73. uglify()
  74. ]
  75. });
  76. const prodCSS = merge(devCSS, {
  77. output: {
  78. file: 'dist/xhiveframework-datatable.min.css'
  79. }
  80. });
  81. const developmentAssets = [devIIFE, devCjs, devCSS];
  82. const productionAssets = [prodIIFE, prodCSS];
  83. const assets = production ? productionAssets : developmentAssets;
  84. export default assets;