@needle-tools/gltf-progressive 1.0.0-alpha → 1.0.0-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/vite.config.ts DELETED
@@ -1,69 +0,0 @@
1
- // vite.config.ts
2
- import { resolve } from 'path';
3
- import { defineConfig } from 'vite';
4
- import { transform } from 'esbuild';
5
-
6
- // https://vitejs.dev/guide/build.html#library-mode
7
-
8
-
9
- // @ts-ignore sorry not sure how to fix this
10
- export default defineConfig(() => {
11
-
12
- console.log("########################################### Begin Build")
13
-
14
- // const isLightMode = process.argv.includes('--light');
15
- const clearOutputDirectory = process.argv.includes('--noclear') === false;
16
-
17
- let postfix = "";
18
-
19
- return {
20
- plugins: [
21
- // ...getPluginsForLibrary({
22
- // light: isLightMode
23
- // })
24
- ],
25
- build: {
26
- emptyOutDir: clearOutputDirectory,
27
- lib: {
28
- entry: resolve(__dirname, 'src/index.ts'),
29
- name: 'needle-tools-gltf-progressive',
30
- formats: ['es', 'esm', 'cjs'],
31
- fileName: (format) => ({
32
- es: `@needle-tools-gltf-progressive${postfix}.js`,
33
- esm: `@needle-tools-gltf-progressive${postfix}.min.js`,
34
- cjs: `@needle-tools-gltf-progressive${postfix}.umd.cjs`,
35
- }[format]),
36
- },
37
- rollupOptions: {
38
- external: ["three",
39
- "three/examples/jsm/loaders/GLTFLoader.js",
40
- "three/examples/jsm/libs/meshopt_decoder.module.js",
41
- "three/examples/jsm/loaders/DRACOLoader.js",
42
- "three/examples/jsm/loaders/KTX2Loader.js",
43
- ],
44
- output: {
45
- plugins: [minifyEs()],
46
- // prevent rollup from generating separate chunks
47
- manualChunks: _ => "needle-tools-gltf-progressive"
48
- }
49
- }
50
- }
51
- }
52
- });
53
-
54
-
55
- // https://github.com/vitejs/vite/issues/6555
56
- function minifyEs() {
57
- return {
58
- name: 'minifyEs',
59
- renderChunk: {
60
- order: 'post',
61
- async handler(code, chunk, outputOptions) {
62
- if (outputOptions.format === 'es' && chunk.fileName.endsWith('.min.js')) {
63
- return await transform(code, { minify: true });
64
- }
65
- return code;
66
- },
67
- }
68
- };
69
- }