threepipe
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. import {defineConfig} from 'vite'
  2. import json from '@rollup/plugin-json';
  3. import dts from 'vite-plugin-dts'
  4. import packageJson from './package.json';
  5. import license from 'rollup-plugin-license';
  6. import replace from '@rollup/plugin-replace';
  7. import glsl from 'rollup-plugin-glsl';
  8. import path from 'node:path';
  9. const isProd = process.env.NODE_ENV === 'production'
  10. const { name, version, author } = packageJson
  11. const {main, module, browser} = packageJson
  12. const alias = {
  13. 'three': path.resolve(__dirname, './node_modules/three/'),
  14. 'threepipe': path.resolve(__dirname, './src/index.ts'),
  15. '@threepipe/plugin-network': path.resolve(__dirname, './plugins/network/src/index.ts'),
  16. '@threepipe/plugin-tweakpane': path.resolve(__dirname, './plugins/tweakpane/src/index.ts'),
  17. '@threepipe/plugin-blueprintjs': path.resolve(__dirname, './plugins/blueprintjs/src/index.ts'),
  18. '@threepipe/plugin-svg-renderer': path.resolve(__dirname, './plugins/svg-renderer/src/index.ts'),
  19. '@threepipe/plugin-tweakpane-editor': path.resolve(__dirname, './plugins/tweakpane-editor/src/index.ts'),
  20. '@threepipe/plugin-blend-importer': path.resolve(__dirname, './plugins/blend-importer/src/index.ts'),
  21. '@threepipe/plugins-extra-importers': path.resolve(__dirname, './plugins/extra-importers/src/index.ts'),
  22. '@threepipe/plugin-geometry-generator': path.resolve(__dirname, './plugins/geometry-generator/src/index.ts'),
  23. '@threepipe/plugin-gaussian-splatting': path.resolve(__dirname, './plugins/gaussian-splatting/src/index.ts'),
  24. '@threepipe/plugin-configurator': path.resolve(__dirname, './plugins/configurator/src/index.ts'),
  25. '@threepipe/plugin-gltf-transform': path.resolve(__dirname, './plugins/gltf-transform/src/index.ts'),
  26. '@threepipe/plugin-assimpjs': path.resolve(__dirname, './plugins/assimpjs/src/index.ts'),
  27. '@threepipe/plugin-path-tracing': path.resolve(__dirname, './plugins/path-tracing/src/index.ts'),
  28. '@threepipe/plugin-3d-tiles-renderer': path.resolve(__dirname, './plugins/3d-tiles-renderer/src/index.ts'),
  29. '@threepipe/webgi-plugins': 'https://unpkg.com/@threepipe/webgi-plugins@0.4.1/dist/index.mjs',
  30. 'react': 'https://esm.sh/react@18',
  31. 'react-dom': 'https://esm.sh/react-dom@18',
  32. 'vue': 'https://unpkg.com/vue@3/dist/vue.esm-browser.prod.js',
  33. 'vue-import': 'https://unpkg.com/vue-import/dist/vue-import.esm-browser.js',
  34. }
  35. export default defineConfig({
  36. optimizeDeps: {
  37. exclude: ['uiconfig.js', 'ts-browser-helpers', ...Object.keys(alias)],
  38. },
  39. // define: {
  40. // 'process.env': process.env
  41. // },
  42. resolve: {
  43. alias,
  44. },
  45. plugins: [
  46. // replace({
  47. // 'process.env.NODE_ENV': JSON.stringify(isProd ? 'production' : 'development'),
  48. // preventAssignment: true,
  49. // }),
  50. glsl({ // todo: minify glsl.
  51. include: '**/*.glsl',
  52. }),
  53. json(),
  54. // postcss({
  55. // modules: false,
  56. // autoModules: true, // todo; issues with typescript import css, because inject is false
  57. // inject: false,
  58. // minimize: isProduction,
  59. // // Or with custom options for `postcss-modules`
  60. // }),
  61. license({
  62. banner: `
  63. @license
  64. ${name} v${version}
  65. Copyright 2022<%= moment().format('YYYY') > 2022 ? '-' + moment().format('YYYY') : null %> ${author}
  66. ${packageJson.license} License
  67. See ./dependencies.txt for bundled third-party dependencies and licenses.
  68. `,
  69. thirdParty: {
  70. output: path.join(__dirname, 'dist', 'dependencies.txt'),
  71. includePrivate: true, // Default is false.
  72. },
  73. }),
  74. {
  75. name: 'transform-html-replace-js-to-ts',
  76. apply: 'serve',
  77. transformIndexHtml (html) {
  78. return html.replace('src="./script.js"', 'src="./script.ts"');
  79. },
  80. },
  81. ],
  82. })