forked from vitejs/vite
/
index.html
130 lines (97 loc) · 3.81 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<h1>Optimize Deps</h1>
<h2>CommonJS w/ named imports (react)</h2>
<div class="cjs"></div>
<h2>CommonJS w/ named imports (phoenix)</h2>
<div class="cjs-phoenix">fail</div>
<h2>CommonJS w/ default export (clipboard)</h2>
<div class="cjs-clipboard">fail</div>
<script type="module" src="./cjs.js"></script>
<h2>CommonJS dynamic import default + named (react)</h2>
<div class="cjs-dynamic"></div>
<h2>CommonJS dynamic import named (phoenix)</h2>
<div class="cjs-dynamic-phoenix"></div>
<h2>CommonJS dynamic import default (clipboard)</h2>
<div class="cjs-dynamic-clipboard"></div>
<h2>CommonJS dynamic import default (dep-cjs-compiled-from-esm)</h2>
<div class="cjs-dynamic-dep-cjs-compiled-from-esm"></div>
<h2>CommonJS dynamic import default (dep-cjs-compiled-from-cjs)</h2>
<div class="cjs-dynamic-dep-cjs-compiled-from-cjs"></div>
<script type="module" src="./cjs-dynamic.js"></script>
<h2>Dedupe (dep in linked & optimized package)</h2>
<div class="dedupe"></div>
<script type="module" src="./dedupe.js"></script>
<h2>CommonJS w/ browser field mapping (axios)</h2>
<div>This should show pong: <span class="cjs-browser-field"></span></div>
<h2>Detecting linked src package and optimizing its deps (lodash-es)</h2>
<div>This should show fooBarBaz: <span class="deps-linked"></span></div>
<h2>Optimizing force included dep even when it's linked</h2>
<div class="force-include"></div>
<h2>import * as ...</h2>
<div class="import-star"></div>
<h2>Import from dependency with process.env.NODE_ENV</h2>
<div class="node-env"></div>
<h2>Import from dependency with .notjs files</h2>
<div class="not-js"></div>
<h2>Import from dependency with dynamic import</h2>
<div class="dep-with-dynamic-import"></div>
<h2>Dep w/ special file format supported via plugins</h2>
<div class="plugin"></div>
<h2>Vue & Vuex</h2>
<div class="vue"></div>
<h2>Dep with changes from esbuild plugin</h2>
<div>This should show a greeting: <span class="esbuild-plugin"></span></div>
<h2>Dep from hidden dir</h2>
<div>This should show hello!: <span class="hidden-dir"></span></div>
<h2>Nested include</h2>
<div>Module path: <span class="nested-include"></span></div>
<h2>Alias with colon</h2>
<div>URL: <span class="url"></span></div>
<h2>Reused variable names</h2>
<div>This should show reused: <span class="reused-variable-names"></span></div>
<script>
function text(el, text) {
document.querySelector(el).textContent = text
}
</script>
<script type="module">
// test dep detection in globbed files
const globbed = import.meta.globEager('./glob/*.js')
import { camelCase } from 'dep-linked'
text('.deps-linked', camelCase('foo-bar-baz'))
import { msg, VueSFC } from 'dep-linked-include'
text('.force-include', msg)
text('.plugin', VueSFC.render())
import * as linked from 'dep-linked-include'
const keys = Object.keys(linked)
if (keys.length) {
text('.import-star', `[success] ${keys.join(', ')}`)
}
import { env } from 'dep-node-env'
text('.node-env', env)
import { notjsValue } from 'dep-not-js'
text('.not-js', notjsValue)
import { lazyFoo } from 'dep-with-dynamic-import'
lazyFoo().then((foo) => {
text('.dep-with-dynamic-import', foo)
})
import { createApp } from 'vue'
import { createStore } from 'vuex'
if (typeof createApp === 'function' && typeof createStore === 'function') {
text('.vue', '[success]')
}
import { hello } from 'dep-esbuild-plugin-transform'
text('.esbuild-plugin', hello())
import { greeting } from './.hidden-dir/foo.js'
text('.hidden-dir', greeting)
import { nestedInclude } from 'nested-exclude'
text('.nested-include', nestedInclude)
import { parse } from 'node:url'
text('.url', parse('https://vitejs.dev').hostname)
</script>
<script type="module">
const reusedName = 1
</script>
<script type="module">
const reusedName = 'reused'
text('.reused-variable-names', reusedName)
</script>