threepipe
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

rollup.config.mjs 2.7KB

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