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

rollup.config.mjs 2.8KB

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