threepipe
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. // rollup.config.js
  2. import commonjs from '@rollup/plugin-commonjs';
  3. import json from '@rollup/plugin-json';
  4. import resolve from '@rollup/plugin-node-resolve';
  5. import typescript from '@rollup/plugin-typescript';
  6. import license from 'rollup-plugin-license'
  7. import packageJson from './package.json' assert {type: 'json'};
  8. import path from 'path'
  9. import {fileURLToPath} from 'url';
  10. import terser from "@rollup/plugin-terser";
  11. import postcss from 'rollup-plugin-postcss'
  12. const __filename = fileURLToPath(import.meta.url);
  13. const __dirname = path.dirname(__filename);
  14. const {name, version, author} = packageJson
  15. const {main, module, browser} = packageJson["clean-package"].replace
  16. const isProduction = process.env.NODE_ENV === 'production'
  17. const settings = {
  18. globals: {},
  19. sourcemap: true
  20. }
  21. export default {
  22. input: './src/index.ts',
  23. output: [
  24. // {
  25. // file: main,
  26. // name: main,
  27. // ...settings,
  28. // format: 'cjs',
  29. // plugins: [
  30. // isProduction && terser()
  31. // ]
  32. // },
  33. {
  34. file: module,
  35. ...settings,
  36. name: name,
  37. format: 'es'
  38. },
  39. {
  40. file: browser,
  41. ...settings,
  42. name: name,
  43. format: 'umd',
  44. plugins: [
  45. isProduction && terser()
  46. ]
  47. }
  48. ],
  49. external: [],
  50. plugins: [
  51. postcss({
  52. modules: false,
  53. autoModules: true, // todo; issues with typescript import css, because inject is false
  54. inject: false,
  55. minimize: isProduction,
  56. // Or with custom options for `postcss-modules`
  57. }),
  58. json(),
  59. resolve({}),
  60. typescript({}),
  61. commonjs({
  62. include: 'node_modules/**',
  63. extensions: ['.js'],
  64. ignoreGlobal: false,
  65. sourceMap: false
  66. }),
  67. license({
  68. banner: `
  69. @license
  70. ${name} v${version}
  71. Copyright 2022<%= moment().format('YYYY') > 2022 ? '-' + moment().format('YYYY') : null %> ${author}
  72. ${packageJson.license} License
  73. `,
  74. thirdParty: {
  75. output: path.join(__dirname, 'dist', 'dependencies.txt'),
  76. includePrivate: true, // Default is false.
  77. },
  78. })
  79. ]
  80. }