├── .editorconfig ├── .eslintrc.cjs ├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.yml │ ├── config.yml │ └── feature_request.yml ├── PULL_REQUEST_TEMPLATE.md ├── commit-convention.md ├── issue-workflow.png ├── pr-workflow.png ├── renovate.json5 ├── semantic.yml └── workflows │ ├── ci.yml │ ├── issue-close-require.yml │ ├── issue-labeled.yml │ ├── lock-closed-issues.yml │ └── release-tag.yml ├── .gitignore ├── .prettierignore ├── .prettierrc.json ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── browser-vite.svg ├── docs ├── .vitepress │ ├── config.js │ └── theme │ │ ├── custom.css │ │ ├── index.js │ │ ├── sponsors.css │ │ └── sponsors.json ├── blog │ └── announcing-vite2.md ├── config │ └── index.md ├── guide │ ├── api-hmr.md │ ├── api-javascript.md │ ├── api-plugin.md │ ├── assets.md │ ├── backend-integration.md │ ├── build.md │ ├── comparisons.md │ ├── dep-pre-bundling.md │ ├── env-and-mode.md │ ├── features.md │ ├── index.md │ ├── migration.md │ ├── ssr.md │ ├── static-deploy.md │ ├── using-plugins.md │ └── why.md ├── images │ ├── bundler.png │ ├── esm.png │ ├── graph.png │ ├── vercel-configuration.png │ └── vite-plugin-inspect.png ├── index.md ├── plugins │ └── index.md └── public │ ├── _headers │ ├── divriots.png │ ├── finclip.png │ ├── logo.svg │ ├── mux.svg │ ├── plaid.svg │ ├── stackblitz.svg │ ├── tailwind-labs.svg │ ├── vite.mp3 │ ├── voice.svg │ └── vuejobs.png ├── jest.config.ts ├── netlify.toml ├── package.json ├── packages ├── create-app │ ├── README.md │ ├── index.js │ └── package.json ├── create-vite │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── __tests__ │ │ └── cli.spec.ts │ ├── index.js │ ├── package.json │ ├── template-lit-ts │ │ ├── _gitignore │ │ ├── index.html │ │ ├── package.json │ │ ├── src │ │ │ ├── favicon.svg │ │ │ ├── my-element.ts │ │ │ └── vite-env.d.ts │ │ ├── tsconfig.json │ │ └── vite.config.ts │ ├── template-lit │ │ ├── _gitignore │ │ ├── index.html │ │ ├── package.json │ │ ├── src │ │ │ ├── favicon.svg │ │ │ └── my-element.js │ │ └── vite.config.js │ ├── template-preact-ts │ │ ├── _gitignore │ │ ├── index.html │ │ ├── package.json │ │ ├── src │ │ │ ├── app.tsx │ │ │ ├── favicon.svg │ │ │ ├── index.css │ │ │ ├── logo.tsx │ │ │ ├── main.tsx │ │ │ ├── preact.d.ts │ │ │ └── vite-env.d.ts │ │ ├── tsconfig.json │ │ └── vite.config.ts │ ├── template-preact │ │ ├── _gitignore │ │ ├── index.html │ │ ├── package.json │ │ ├── src │ │ │ ├── app.jsx │ │ │ ├── favicon.svg │ │ │ ├── index.css │ │ │ ├── logo.jsx │ │ │ └── main.jsx │ │ └── vite.config.js │ ├── template-react-ts │ │ ├── _gitignore │ │ ├── index.html │ │ ├── package.json │ │ ├── src │ │ │ ├── App.css │ │ │ ├── App.tsx │ │ │ ├── favicon.svg │ │ │ ├── index.css │ │ │ ├── logo.svg │ │ │ ├── main.tsx │ │ │ └── vite-env.d.ts │ │ ├── tsconfig.json │ │ └── vite.config.ts │ ├── template-react │ │ ├── _gitignore │ │ ├── index.html │ │ ├── package.json │ │ ├── src │ │ │ ├── App.css │ │ │ ├── App.jsx │ │ │ ├── favicon.svg │ │ │ ├── index.css │ │ │ ├── logo.svg │ │ │ └── main.jsx │ │ └── vite.config.js │ ├── template-svelte-ts │ │ ├── .vscode │ │ │ └── extensions.json │ │ ├── README.md │ │ ├── _gitignore │ │ ├── index.html │ │ ├── package.json │ │ ├── public │ │ │ └── favicon.ico │ │ ├── src │ │ │ ├── App.svelte │ │ │ ├── assets │ │ │ │ └── svelte.png │ │ │ ├── lib │ │ │ │ └── Counter.svelte │ │ │ ├── main.ts │ │ │ └── vite-env.d.ts │ │ ├── svelte.config.js │ │ ├── tsconfig.json │ │ └── vite.config.js │ ├── template-svelte │ │ ├── .vscode │ │ │ └── extensions.json │ │ ├── README.md │ │ ├── _gitignore │ │ ├── index.html │ │ ├── jsconfig.json │ │ ├── package.json │ │ ├── public │ │ │ └── favicon.ico │ │ ├── src │ │ │ ├── App.svelte │ │ │ ├── assets │ │ │ │ └── svelte.png │ │ │ ├── lib │ │ │ │ └── Counter.svelte │ │ │ ├── main.js │ │ │ └── vite-env.d.ts │ │ └── vite.config.js │ ├── template-vanilla-ts │ │ ├── _gitignore │ │ ├── favicon.svg │ │ ├── index.html │ │ ├── package.json │ │ ├── src │ │ │ ├── main.ts │ │ │ ├── style.css │ │ │ └── vite-env.d.ts │ │ └── tsconfig.json │ ├── template-vanilla │ │ ├── _gitignore │ │ ├── favicon.svg │ │ ├── index.html │ │ ├── main.js │ │ ├── package.json │ │ └── style.css │ ├── template-vue-ts │ │ ├── .vscode │ │ │ └── extensions.json │ │ ├── README.md │ │ ├── _gitignore │ │ ├── index.html │ │ ├── package.json │ │ ├── public │ │ │ └── favicon.ico │ │ ├── src │ │ │ ├── App.vue │ │ │ ├── assets │ │ │ │ └── logo.png │ │ │ ├── components │ │ │ │ └── HelloWorld.vue │ │ │ ├── env.d.ts │ │ │ └── main.ts │ │ ├── tsconfig.json │ │ └── vite.config.ts │ ├── template-vue │ │ ├── .vscode │ │ │ └── extensions.json │ │ ├── README.md │ │ ├── _gitignore │ │ ├── index.html │ │ ├── package.json │ │ ├── public │ │ │ └── favicon.ico │ │ ├── src │ │ │ ├── App.vue │ │ │ ├── assets │ │ │ │ └── logo.png │ │ │ ├── components │ │ │ │ └── HelloWorld.vue │ │ │ └── main.js │ │ └── vite.config.js │ └── updateVersions.js ├── playground │ ├── alias │ │ ├── __tests__ │ │ │ └── alias.spec.ts │ │ ├── dir │ │ │ ├── from-script-src.js │ │ │ ├── module │ │ │ │ ├── index.js │ │ │ │ └── package.json │ │ │ ├── test.css │ │ │ └── test.js │ │ ├── index.html │ │ ├── package.json │ │ ├── test.js │ │ └── vite.config.js │ ├── assets │ │ ├── __tests__ │ │ │ └── assets.spec.ts │ │ ├── css │ │ │ ├── css-url.css │ │ │ ├── fonts.css │ │ │ ├── icons.css │ │ │ └── nested │ │ │ │ └── at-imported-css-url.css │ │ ├── fonts │ │ │ ├── Inter-Italic.woff │ │ │ └── Inter-Italic.woff2 │ │ ├── foo.js │ │ ├── index.html │ │ ├── nested │ │ │ ├── asset.png │ │ │ ├── fragment-bg.svg │ │ │ ├── fragment.svg │ │ │ ├── icon.png │ │ │ └── テスト-測試-white space.png │ │ ├── package.json │ │ ├── static │ │ │ ├── icon.png │ │ │ ├── raw.css │ │ │ └── raw.js │ │ ├── vite.config.js │ │ └── テスト-測試-white space.js │ ├── backend-integration │ │ ├── __tests__ │ │ │ └── backend-integration.spec.ts │ │ ├── frontend │ │ │ ├── entrypoints │ │ │ │ ├── global.css │ │ │ │ ├── index.html │ │ │ │ └── main.ts │ │ │ ├── images │ │ │ │ └── logo.png │ │ │ └── styles │ │ │ │ ├── background.css │ │ │ │ └── tailwind.css │ │ ├── package.json │ │ ├── postcss.config.js │ │ ├── references.css │ │ ├── tailwind.config.js │ │ └── vite.config.js │ ├── cli-module │ │ ├── __tests__ │ │ │ ├── cli-module.spec.ts │ │ │ └── serve.js │ │ ├── index.html │ │ ├── index.js │ │ ├── package.json │ │ └── vite.config.js │ ├── cli │ │ ├── __tests__ │ │ │ ├── cli.spec.ts │ │ │ └── serve.js │ │ ├── index.html │ │ ├── index.js │ │ ├── package.json │ │ └── vite.config.js │ ├── css-codesplit-cjs │ │ ├── __tests__ │ │ │ └── css-codesplit.spec.ts │ │ ├── index.html │ │ ├── main.css │ │ ├── main.js │ │ ├── other.js │ │ ├── package.json │ │ ├── style.css │ │ └── vite.config.js │ ├── css-codesplit │ │ ├── __tests__ │ │ │ └── css-codesplit.spec.ts │ │ ├── index.html │ │ ├── main.css │ │ ├── main.js │ │ ├── other.js │ │ ├── package.json │ │ ├── style.css │ │ └── vite.config.js │ ├── css │ │ ├── __tests__ │ │ │ └── css.spec.ts │ │ ├── async-treeshaken.css │ │ ├── async-treeshaken.js │ │ ├── async.css │ │ ├── async.js │ │ ├── composed.module.css │ │ ├── composed.module.less │ │ ├── composed.module.scss │ │ ├── composes-path-resolving.module.css │ │ ├── css-dep │ │ │ ├── index.css │ │ │ ├── index.js │ │ │ ├── index.scss │ │ │ ├── index.styl │ │ │ └── package.json │ │ ├── dep.css │ │ ├── glob-dep.css │ │ ├── glob-dep │ │ │ ├── bar.css │ │ │ └── foo.css │ │ ├── imported-at-import.css │ │ ├── imported.css │ │ ├── index.html │ │ ├── inlined.css │ │ ├── less.less │ │ ├── linked-at-import.css │ │ ├── linked.css │ │ ├── main.js │ │ ├── minify.css │ │ ├── mod.module.css │ │ ├── mod.module.scss │ │ ├── nested │ │ │ ├── _index.scss │ │ │ ├── _partial.scss │ │ │ ├── icon.png │ │ │ ├── nested.less │ │ │ └── nested.styl │ │ ├── ok.png │ │ ├── options │ │ │ ├── absolute-import.styl │ │ │ └── relative-import.styl │ │ ├── package.json │ │ ├── pkg-dep │ │ │ ├── _index.scss │ │ │ ├── index.js │ │ │ └── package.json │ │ ├── postcss-caching │ │ │ ├── blue-app │ │ │ │ ├── imported.css │ │ │ │ ├── index.html │ │ │ │ ├── main.js │ │ │ │ ├── package.json │ │ │ │ └── postcss.config.js │ │ │ ├── css.spec.ts │ │ │ └── green-app │ │ │ │ ├── imported.css │ │ │ │ ├── index.html │ │ │ │ ├── main.js │ │ │ │ ├── package.json │ │ │ │ └── postcss.config.js │ │ ├── postcss.config.js │ │ ├── sass.scss │ │ ├── stylus.styl │ │ └── vite.config.js │ ├── data-uri │ │ ├── __tests__ │ │ │ └── data-uri.spec.ts │ │ ├── index.html │ │ └── package.json │ ├── define │ │ ├── __tests__ │ │ │ └── define.spec.ts │ │ ├── index.html │ │ ├── package.json │ │ └── vite.config.js │ ├── dynamic-import │ │ ├── __tests__ │ │ │ └── dynamic-import.spec.ts │ │ ├── css │ │ │ └── index.css │ │ ├── index.html │ │ ├── mxd.js │ │ ├── mxd.json │ │ ├── nested │ │ │ ├── index.js │ │ │ └── shared.js │ │ ├── package.json │ │ ├── qux.js │ │ ├── views │ │ │ ├── bar.js │ │ │ ├── baz.js │ │ │ └── foo.js │ │ └── vite.config.js │ ├── env │ │ ├── .env │ │ ├── .env.development │ │ ├── .env.production │ │ ├── __tests__ │ │ │ └── env.spec.ts │ │ ├── index.html │ │ ├── package.json │ │ └── vite.config.js │ ├── extensions │ │ ├── __tests__ │ │ │ └── extensions.spec.ts │ │ ├── index.html │ │ ├── package.json │ │ └── vite.config.js │ ├── file-delete-restore │ │ ├── App.jsx │ │ ├── Child.jsx │ │ ├── __tests__ │ │ │ └── file-delete-restore.spec.ts │ │ ├── index.html │ │ ├── package.json │ │ └── vite.config.js │ ├── fs-serve │ │ ├── __tests__ │ │ │ └── fs-serve.spec.ts │ │ ├── entry.js │ │ ├── nested │ │ │ └── foo.js │ │ ├── package.json │ │ ├── root │ │ │ ├── src │ │ │ │ ├── .env │ │ │ │ ├── index.html │ │ │ │ └── safe.txt │ │ │ ├── unsafe.txt │ │ │ └── vite.config.js │ │ ├── safe.json │ │ └── unsafe.json │ ├── glob-import │ │ ├── __tests__ │ │ │ └── glob-import.spec.ts │ │ ├── dir │ │ │ ├── baz.json │ │ │ ├── foo.js │ │ │ ├── index.js │ │ │ └── nested │ │ │ │ └── bar.js │ │ ├── index.html │ │ └── package.json │ ├── hmr │ │ ├── __tests__ │ │ │ └── hmr.spec.ts │ │ ├── customFile.js │ │ ├── hmr.js │ │ ├── hmrDep.js │ │ ├── hmrNestedDep.js │ │ ├── index.html │ │ ├── package.json │ │ └── vite.config.js │ ├── html │ │ ├── __tests__ │ │ │ └── html.spec.ts │ │ ├── common.css │ │ ├── foo.html │ │ ├── index.html │ │ ├── inline │ │ │ ├── common.js │ │ │ ├── dep1.js │ │ │ ├── dep2.js │ │ │ ├── dep3.js │ │ │ ├── module-graph.dot │ │ │ ├── shared-1.html │ │ │ ├── shared-2.html │ │ │ ├── shared.js │ │ │ ├── unique.html │ │ │ └── unique.js │ │ ├── main.css │ │ ├── main.js │ │ ├── nested │ │ │ ├── index.html │ │ │ ├── nested.css │ │ │ └── nested.js │ │ ├── noBody.html │ │ ├── noHead.html │ │ ├── package.json │ │ ├── scriptAsync.html │ │ ├── scriptMixed.html │ │ ├── shared.js │ │ ├── unicode-path │ │ │ └── 中文-にほんご-한글-🌕🌖🌗 │ │ │ │ └── index.html │ │ ├── vite.config.js │ │ └── zeroJS.html │ ├── json │ │ ├── __tests__ │ │ │ └── json.spec.ts │ │ ├── index.html │ │ ├── package.json │ │ ├── public │ │ │ └── public.json │ │ └── test.json │ ├── legacy │ │ ├── __tests__ │ │ │ ├── legacy.spec.ts │ │ │ └── ssr │ │ │ │ ├── legacy-ssr.spec.ts │ │ │ │ └── serve.js │ │ ├── async.js │ │ ├── entry-server.js │ │ ├── immutable-chunk.js │ │ ├── index.html │ │ ├── main.js │ │ ├── package.json │ │ ├── vite.config-custom-filename.js │ │ └── vite.config.js │ ├── lib │ │ ├── __tests__ │ │ │ ├── lib.spec.ts │ │ │ └── serve.js │ │ ├── index.dist.html │ │ ├── index.html │ │ ├── package.json │ │ ├── src │ │ │ ├── main.js │ │ │ ├── main2.js │ │ │ └── message.js │ │ ├── vite.config.js │ │ └── vite.dyimport.config.js │ ├── multiple-entrypoints │ │ ├── __tests__ │ │ │ └── multiple-entrypoints.spec.ts │ │ ├── deps.json │ │ ├── dynamic-a.js │ │ ├── dynamic-b.js │ │ ├── entrypoints │ │ │ ├── a0.js │ │ │ ├── a1.js │ │ │ ├── a10.js │ │ │ ├── a11.js │ │ │ ├── a12.js │ │ │ ├── a13.js │ │ │ ├── a14.js │ │ │ ├── a15.js │ │ │ ├── a16.js │ │ │ ├── a17.js │ │ │ ├── a18.js │ │ │ ├── a19.js │ │ │ ├── a2.js │ │ │ ├── a20.js │ │ │ ├── a21.js │ │ │ ├── a22.js │ │ │ ├── a23.js │ │ │ ├── a24.js │ │ │ ├── a3.js │ │ │ ├── a4.js │ │ │ ├── a5.js │ │ │ ├── a6.js │ │ │ ├── a7.js │ │ │ ├── a8.js │ │ │ └── a9.js │ │ ├── index.html │ │ ├── index.js │ │ ├── package.json │ │ ├── reference.js │ │ ├── reference.scss │ │ └── vite.config.js │ ├── nested-deps │ │ ├── __tests__ │ │ │ └── nested-deps.spec.ts │ │ ├── index.html │ │ ├── package.json │ │ ├── test-package-a │ │ │ ├── index.js │ │ │ └── package.json │ │ ├── test-package-b │ │ │ ├── index.js │ │ │ ├── node_modules │ │ │ │ └── test-package-a │ │ │ │ │ ├── index.js │ │ │ │ │ └── package.json │ │ │ └── package.json │ │ ├── test-package-c │ │ │ ├── index-es.js │ │ │ ├── index.js │ │ │ ├── package.json │ │ │ └── side.js │ │ ├── test-package-d │ │ │ ├── index.js │ │ │ ├── package.json │ │ │ └── test-package-d-nested │ │ │ │ ├── index.js │ │ │ │ └── package.json │ │ ├── test-package-e │ │ │ ├── index.js │ │ │ ├── package.json │ │ │ ├── test-package-e-excluded │ │ │ │ ├── index.js │ │ │ │ └── package.json │ │ │ └── test-package-e-included │ │ │ │ ├── index.js │ │ │ │ └── package.json │ │ └── vite.config.js │ ├── optimize-deps │ │ ├── .hidden-dir │ │ │ └── foo.js │ │ ├── __tests__ │ │ │ └── optimize-deps.spec.ts │ │ ├── cjs-dynamic.js │ │ ├── cjs.js │ │ ├── dedupe.js │ │ ├── dep-cjs-compiled-from-cjs │ │ │ ├── index.js │ │ │ └── package.json │ │ ├── dep-cjs-compiled-from-esm │ │ │ ├── index.js │ │ │ └── package.json │ │ ├── dep-esbuild-plugin-transform │ │ │ ├── index.js │ │ │ └── package.json │ │ ├── dep-linked-include │ │ │ ├── Test.vue │ │ │ ├── foo.js │ │ │ ├── index.mjs │ │ │ ├── package.json │ │ │ └── test.css │ │ ├── dep-linked │ │ │ ├── index.js │ │ │ └── package.json │ │ ├── glob │ │ │ └── foo.js │ │ ├── index.html │ │ ├── nested-exclude │ │ │ ├── index.js │ │ │ ├── nested-include │ │ │ │ ├── index.js │ │ │ │ └── package.json │ │ │ └── package.json │ │ ├── package.json │ │ └── vite.config.js │ ├── optimize-missing-deps │ │ ├── __test__ │ │ │ ├── optimize-missing-deps.spec.ts │ │ │ └── serve.js │ │ ├── index.html │ │ ├── main.js │ │ ├── missing-dep │ │ │ ├── index.js │ │ │ └── package.json │ │ ├── multi-entry-dep │ │ │ ├── index.browser.js │ │ │ ├── index.js │ │ │ └── package.json │ │ ├── package.json │ │ └── server.js │ ├── package.json │ ├── preload │ │ ├── __tests__ │ │ │ └── preload.spec.ts │ │ ├── index.html │ │ ├── package.json │ │ ├── router.js │ │ ├── src │ │ │ ├── App.vue │ │ │ └── components │ │ │ │ ├── About.vue │ │ │ │ ├── Hello.vue │ │ │ │ └── Home.vue │ │ └── vite.config.js │ ├── preserve-symlinks │ │ ├── __tests__ │ │ │ └── preserve-symlinks.spec.ts │ │ ├── index.html │ │ ├── moduleA │ │ │ ├── linked.js │ │ │ ├── package.json │ │ │ └── src │ │ │ │ ├── data.js │ │ │ │ └── index.js │ │ ├── package.json │ │ └── src │ │ │ └── main.js │ ├── react-emotion │ │ ├── App.jsx │ │ ├── __tests__ │ │ │ └── react.spec.ts │ │ ├── index.html │ │ ├── package.json │ │ └── vite.config.ts │ ├── react │ │ ├── App.jsx │ │ ├── __tests__ │ │ │ └── react.spec.ts │ │ ├── components │ │ │ └── Dummy.jsx │ │ ├── index.html │ │ ├── package.json │ │ └── vite.config.ts │ ├── resolve-linked │ │ ├── dep.js │ │ ├── package.json │ │ └── src │ │ │ └── index.js │ ├── resolve │ │ ├── __tests__ │ │ │ └── resolve.spec.ts │ │ ├── browser-field │ │ │ ├── multiple.dot.path.js │ │ │ ├── no-ext-index │ │ │ │ └── index.js │ │ │ ├── no-ext.js │ │ │ ├── not-browser.js │ │ │ ├── out │ │ │ │ ├── cjs.node.js │ │ │ │ └── esm.browser.js │ │ │ ├── package.json │ │ │ └── relative.js │ │ ├── config-dep.js │ │ ├── custom-condition │ │ │ ├── index.custom.js │ │ │ ├── index.js │ │ │ └── package.json │ │ ├── custom-ext.es │ │ ├── custom-main-field │ │ │ ├── index.custom.js │ │ │ ├── index.js │ │ │ └── package.json │ │ ├── dir-with-ext.js │ │ │ └── empty │ │ ├── dir-with-ext │ │ │ └── index.js │ │ ├── dir.js │ │ ├── dir │ │ │ └── index.js │ │ ├── exact-extension │ │ │ ├── file.js │ │ │ └── file.js.js │ │ ├── exports-env │ │ │ ├── browser.js │ │ │ ├── browser.mjs │ │ │ ├── browser.prod.mjs │ │ │ ├── fallback.umd.js │ │ │ └── package.json │ │ ├── exports-path │ │ │ ├── cjs.js │ │ │ ├── deep.js │ │ │ ├── dir │ │ │ │ └── dir.js │ │ │ ├── main.js │ │ │ └── package.json │ │ ├── index.html │ │ ├── inline-package │ │ │ ├── inline.js │ │ │ └── package.json │ │ ├── package.json │ │ ├── ts-extension │ │ │ ├── hello.ts │ │ │ └── index.ts │ │ ├── utf8-bom │ │ │ └── main.js │ │ ├── util │ │ │ ├── bar.util.js │ │ │ └── index.js │ │ └── vite.config.js │ ├── shims.d.ts │ ├── ssr-deps │ │ ├── __tests__ │ │ │ ├── serve.js │ │ │ └── ssr-deps.spec.ts │ │ ├── forwarded-export │ │ │ ├── index.js │ │ │ └── package.json │ │ ├── index.html │ │ ├── message │ │ ├── node-addon │ │ │ ├── README.md │ │ │ ├── binding.gyp │ │ │ ├── index.js │ │ │ ├── main.cpp │ │ │ └── package.json │ │ ├── object-assigned-exports │ │ │ ├── index.js │ │ │ └── package.json │ │ ├── package.json │ │ ├── primitive-export │ │ │ ├── index.js │ │ │ └── package.json │ │ ├── read-file-content │ │ │ ├── index.js │ │ │ └── package.json │ │ ├── server.js │ │ ├── src │ │ │ └── app.js │ │ ├── ts-transpiled-exports │ │ │ ├── index.js │ │ │ └── package.json │ │ └── vite.config.js │ ├── ssr-html │ │ ├── __tests__ │ │ │ ├── serve.js │ │ │ └── ssr-html.spec.ts │ │ ├── index.html │ │ ├── package.json │ │ ├── server.js │ │ └── src │ │ │ └── app.js │ ├── ssr-pug │ │ ├── __tests__ │ │ │ ├── serve.js │ │ │ └── ssr-pug.spec.ts │ │ ├── index.pug │ │ ├── package.json │ │ ├── server.js │ │ └── src │ │ │ └── app.js │ ├── ssr-react │ │ ├── __tests__ │ │ │ ├── serve.js │ │ │ └── ssr-react.spec.ts │ │ ├── index.html │ │ ├── package.json │ │ ├── prerender.js │ │ ├── server.js │ │ ├── src │ │ │ ├── App.jsx │ │ │ ├── add.js │ │ │ ├── circular-dep-init │ │ │ │ ├── README.md │ │ │ │ ├── circular-dep-init.js │ │ │ │ ├── module-a.js │ │ │ │ └── module-b.js │ │ │ ├── entry-client.jsx │ │ │ ├── entry-server.jsx │ │ │ ├── forked-deadlock │ │ │ │ ├── README.md │ │ │ │ ├── common-module.js │ │ │ │ ├── deadlock-fuse-module.js │ │ │ │ ├── fuse-stuck-bridge-module.js │ │ │ │ ├── middle-module.js │ │ │ │ └── stuck-module.js │ │ │ ├── multiply.js │ │ │ └── pages │ │ │ │ ├── About.jsx │ │ │ │ ├── Env.jsx │ │ │ │ └── Home.jsx │ │ └── vite.config.js │ ├── ssr-vue │ │ ├── __tests__ │ │ │ ├── serve.js │ │ │ └── ssr-vue.spec.ts │ │ ├── dep-import-type │ │ │ ├── deep │ │ │ │ └── index.d.ts │ │ │ └── package.json │ │ ├── example-external-component │ │ │ ├── ExampleExternalComponent.vue │ │ │ ├── index.js │ │ │ └── package.json │ │ ├── index.html │ │ ├── package.json │ │ ├── prerender.js │ │ ├── server.js │ │ ├── src │ │ │ ├── App.vue │ │ │ ├── assets │ │ │ │ ├── fonts │ │ │ │ │ ├── Inter-Italic.woff │ │ │ │ │ └── Inter-Italic.woff2 │ │ │ │ └── logo.png │ │ │ ├── components │ │ │ │ ├── Foo.jsx │ │ │ │ ├── ImportType.vue │ │ │ │ └── foo.css │ │ │ ├── entry-client.js │ │ │ ├── entry-server.js │ │ │ ├── main.js │ │ │ ├── pages │ │ │ │ ├── About.vue │ │ │ │ ├── External.vue │ │ │ │ ├── Home.vue │ │ │ │ └── Store.vue │ │ │ └── router.js │ │ ├── vite.config.js │ │ └── vite.config.noexternal.js │ ├── ssr-webworker │ │ ├── __tests__ │ │ │ ├── serve.js │ │ │ └── ssr-webworker.spec.ts │ │ ├── package.json │ │ ├── src │ │ │ └── entry-worker.jsx │ │ ├── vite.config.js │ │ └── worker.js │ ├── tailwind │ │ ├── __test__ │ │ │ └── tailwind.spec.ts │ │ ├── index.css │ │ ├── index.html │ │ ├── package.json │ │ ├── postcss.config.js │ │ ├── public │ │ │ └── favicon.ico │ │ ├── src │ │ │ ├── App.vue │ │ │ ├── assets │ │ │ │ └── logo.png │ │ │ ├── components │ │ │ │ └── HelloWorld.vue │ │ │ ├── main.js │ │ │ ├── router.ts │ │ │ └── views │ │ │ │ └── Page.vue │ │ ├── tailwind.config.js │ │ └── vite.config.ts │ ├── testUtils.ts │ ├── tsconfig-json-load-error │ │ ├── __tests__ │ │ │ └── tsconfig-json-load-error.spec.ts │ │ ├── has-error │ │ │ ├── main.ts │ │ │ └── tsconfig.json │ │ ├── index.html │ │ ├── package.json │ │ ├── src │ │ │ └── main.ts │ │ └── tsconfig.json │ ├── tsconfig-json │ │ ├── __tests__ │ │ │ └── tsconfig-json.spec.ts │ │ ├── index.html │ │ ├── nested-with-extends │ │ │ ├── main.ts │ │ │ ├── not-used-type.ts │ │ │ └── tsconfig.json │ │ ├── nested │ │ │ ├── main.ts │ │ │ ├── not-used-type.ts │ │ │ └── tsconfig.json │ │ ├── package.json │ │ ├── src │ │ │ ├── main.ts │ │ │ └── not-used-type.ts │ │ └── tsconfig.json │ ├── tsconfig.json │ ├── vue-jsx │ │ ├── Comp.tsx │ │ ├── Comps.jsx │ │ ├── OtherExt.tesx │ │ ├── Script.vue │ │ ├── SrcImport.jsx │ │ ├── SrcImport.vue │ │ ├── __tests__ │ │ │ └── vue-jsx.spec.ts │ │ ├── index.html │ │ ├── main.jsx │ │ ├── package.json │ │ └── vite.config.js │ ├── vue │ │ ├── Assets.vue │ │ ├── AsyncComponent.vue │ │ ├── CssModules.vue │ │ ├── CustomBlock.vue │ │ ├── CustomBlockPlugin.ts │ │ ├── CustomElement.ce.vue │ │ ├── Hmr.vue │ │ ├── Main.vue │ │ ├── Node.vue │ │ ├── PreProcessors.vue │ │ ├── RefTransform.vue │ │ ├── ScanDep.vue │ │ ├── Slotted.vue │ │ ├── Syntax.vue │ │ ├── __tests__ │ │ │ └── vue.spec.ts │ │ ├── assets │ │ │ ├── asset.png │ │ │ └── fragment.svg │ │ ├── index.html │ │ ├── package.json │ │ ├── public │ │ │ └── icon.png │ │ ├── setup-import-template │ │ │ ├── SetupImportTemplate.vue │ │ │ └── template.html │ │ ├── src-import │ │ │ ├── SrcImport.vue │ │ │ ├── script.ts │ │ │ ├── style.css │ │ │ └── template.html │ │ └── vite.config.ts │ ├── wasm │ │ ├── __tests__ │ │ │ └── wasm.spec.ts │ │ ├── heavy.wasm │ │ ├── heavy.wasm.map │ │ ├── index.html │ │ ├── light.wasm │ │ └── package.json │ └── worker │ │ ├── __tests__ │ │ └── worker.spec.ts │ │ ├── index.html │ │ ├── my-shared-worker.ts │ │ ├── my-worker.ts │ │ ├── package.json │ │ ├── possible-ts-output-worker.mjs │ │ └── workerImport.js ├── plugin-legacy │ ├── CHANGELOG.md │ ├── README.md │ ├── index.d.ts │ ├── index.js │ └── package.json ├── plugin-react │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── api-extractor.json │ ├── package.json │ ├── src │ │ ├── babel.d.ts │ │ ├── fast-refresh.ts │ │ ├── index.ts │ │ └── jsx-runtime │ │ │ ├── babel-import-to-require.ts │ │ │ ├── babel-restore-jsx.spec.ts │ │ │ ├── babel-restore-jsx.ts │ │ │ └── restore-jsx.ts │ └── tsconfig.json ├── plugin-vue-jsx │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── index.d.ts │ ├── index.js │ └── package.json ├── plugin-vue │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── api-extractor.json │ ├── package.json │ ├── src │ │ ├── compiler.ts │ │ ├── handleHotUpdate.ts │ │ ├── helper.ts │ │ ├── index.ts │ │ ├── main.ts │ │ ├── script.ts │ │ ├── style.ts │ │ ├── template.ts │ │ └── utils │ │ │ ├── descriptorCache.ts │ │ │ ├── error.ts │ │ │ └── query.ts │ └── tsconfig.json └── vite │ ├── CHANGELOG.md │ ├── LICENSE.md │ ├── README.md │ ├── api-extractor.json │ ├── bin │ ├── openChrome.applescript │ └── vite.js │ ├── client.d.ts │ ├── package.json │ ├── rollup.config.js │ ├── scripts │ └── patchTypes.cjs │ ├── src │ ├── browser │ │ ├── config.ts │ │ ├── index.ts │ │ ├── plugins │ │ │ ├── index.ts │ │ │ ├── preAlias.ts │ │ │ └── resolve.ts │ │ ├── server │ │ │ ├── hmr.ts │ │ │ └── index.ts │ │ ├── ssr │ │ │ └── ssrModuleLoader.ts │ │ └── tsconfig.json │ ├── client │ │ ├── browser.ts │ │ ├── client.ts │ │ ├── env.ts │ │ ├── overlay.ts │ │ └── tsconfig.json │ └── node │ │ ├── __tests__ │ │ ├── asset.spec.ts │ │ ├── build.spec.ts │ │ ├── config.spec.ts │ │ ├── packages │ │ │ ├── name │ │ │ │ └── package.json │ │ │ └── noname │ │ │ │ └── package.json │ │ ├── plugins │ │ │ ├── css.spec.ts │ │ │ └── import.spec.ts │ │ ├── scan.spec.ts │ │ └── utils.spec.ts │ │ ├── build.ts │ │ ├── cli.ts │ │ ├── config.ts │ │ ├── constants.ts │ │ ├── http.ts │ │ ├── importGlob.ts │ │ ├── index.ts │ │ ├── logger.ts │ │ ├── optimizer │ │ ├── esbuildDepPlugin.ts │ │ ├── index.ts │ │ ├── registerMissing.ts │ │ └── scan.ts │ │ ├── packages.ts │ │ ├── plugin.ts │ │ ├── plugins │ │ ├── asset.ts │ │ ├── assetImportMetaUrl.ts │ │ ├── clientInjections.ts │ │ ├── css.ts │ │ ├── dataUri.ts │ │ ├── define.ts │ │ ├── esbuild.ts │ │ ├── html.ts │ │ ├── importAnalysis.ts │ │ ├── importAnalysisBuild.ts │ │ ├── index.ts │ │ ├── json.ts │ │ ├── loadFallback.ts │ │ ├── manifest.ts │ │ ├── modulePreloadPolyfill.ts │ │ ├── preAlias.ts │ │ ├── reporter.ts │ │ ├── resolve.ts │ │ ├── ssrRequireHook.ts │ │ ├── terser.ts │ │ ├── wasm.ts │ │ └── worker.ts │ │ ├── preview.ts │ │ ├── server │ │ ├── __tests__ │ │ │ ├── fixtures │ │ │ │ ├── none │ │ │ │ │ └── nested │ │ │ │ │ │ └── package.json │ │ │ │ ├── pnpm │ │ │ │ │ ├── nested │ │ │ │ │ │ └── package.json │ │ │ │ │ ├── package.json │ │ │ │ │ └── pnpm-workspace.yaml │ │ │ │ └── yarn │ │ │ │ │ ├── nested │ │ │ │ │ └── package.json │ │ │ │ │ └── package.json │ │ │ ├── pluginContainer.spec.ts │ │ │ └── search-root.spec.ts │ │ ├── hmr.ts │ │ ├── index.ts │ │ ├── middlewares │ │ │ ├── base.ts │ │ │ ├── error.ts │ │ │ ├── indexHtml.ts │ │ │ ├── proxy.ts │ │ │ ├── spaFallback.ts │ │ │ ├── static.ts │ │ │ ├── time.ts │ │ │ └── transform.ts │ │ ├── moduleGraph.ts │ │ ├── openBrowser.ts │ │ ├── pluginContainer.ts │ │ ├── searchRoot.ts │ │ ├── send.ts │ │ ├── sourcemap.ts │ │ ├── transformRequest.ts │ │ └── ws.ts │ │ ├── ssr │ │ ├── __tests__ │ │ │ └── ssrTransform.spec.ts │ │ ├── ssrExternal.ts │ │ ├── ssrManifestPlugin.ts │ │ ├── ssrModuleLoader.ts │ │ ├── ssrStacktrace.ts │ │ └── ssrTransform.ts │ │ ├── tsconfig.json │ │ └── utils.ts │ ├── tsconfig.base.json │ └── types │ ├── alias.d.ts │ ├── anymatch.d.ts │ ├── chokidar.d.ts │ ├── commonjs.d.ts │ ├── connect.d.ts │ ├── customEvent.d.ts │ ├── dynamicImportVars.d.ts │ ├── hmrPayload.d.ts │ ├── http-proxy.d.ts │ ├── importMeta.d.ts │ ├── package.json │ ├── shims.d.ts │ ├── terser.d.ts │ └── ws.d.ts ├── pnpm-lock.yaml ├── pnpm-workspace.yaml └── scripts ├── jestEnv.cjs ├── jestGlobalSetup.cjs ├── jestGlobalTeardown.cjs ├── jestPerTestSetup.ts ├── patchFileDeps.cjs ├── release.cjs └── verifyCommit.cjs /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Discord Chat 4 | url: https://chat.vitejs.dev 5 | about: Ask questions and discuss with other Vite users in real time. 6 | - name: Questions & Discussions 7 | url: https://github.com/vitejs/vite/discussions 8 | about: Use GitHub discussions for message-board style questions and discussions. 9 | -------------------------------------------------------------------------------- /.github/issue-workflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/divriots/browser-vite/5721afb654901fd14b629f0b4d7eafe4587ea189/.github/issue-workflow.png -------------------------------------------------------------------------------- /.github/pr-workflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/divriots/browser-vite/5721afb654901fd14b629f0b4d7eafe4587ea189/.github/pr-workflow.png -------------------------------------------------------------------------------- /.github/semantic.yml: -------------------------------------------------------------------------------- 1 | titleOnly: true 2 | types: 3 | - feat 4 | - fix 5 | - docs 6 | - dx 7 | - refactor 8 | - perf 9 | - test 10 | - workflow 11 | - build 12 | - ci 13 | - chore 14 | - types 15 | - wip 16 | - release 17 | - deps 18 | -------------------------------------------------------------------------------- /.github/workflows/issue-close-require.yml: -------------------------------------------------------------------------------- 1 | name: Issue Close Require 2 | 3 | on: 4 | schedule: 5 | - cron: "0 0 * * *" 6 | 7 | jobs: 8 | close-issues: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - name: need reproduction 12 | uses: actions-cool/issues-helper@v2 13 | with: 14 | actions: "close-issues" 15 | token: ${{ secrets.GITHUB_TOKEN }} 16 | labels: "need reproduction" 17 | inactive-day: 3 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | dist 4 | dist-ssr 5 | TODOs.md 6 | *.log 7 | temp 8 | explorations 9 | .idea 10 | *.local 11 | /packages/vite/LICENSE 12 | *.cpuprofile 13 | /.vscode/ 14 | /packages/playground/ssr-deps/node-addon/build/ 15 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | docs/.vitepress/dist/ 2 | packages/vite/dist/ 3 | packages/vite/temp/ 4 | packages/plugin-react/dist/ 5 | packages/plugin-vue/dist/ 6 | packages/*/CHANGELOG.md 7 | LICENSE.md 8 | .prettierignore 9 | pnpm-lock.yaml 10 | pnpm-workspace.yaml 11 | packages/playground/tsconfig-json-load-error/has-error/tsconfig.json 12 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false, 3 | "tabWidth": 2, 4 | "singleQuote": true, 5 | "printWidth": 80, 6 | "trailingComma": "none", 7 | "overrides": [ 8 | { 9 | "files": ["*.json5"], 10 | "options": { 11 | "singleQuote": false, 12 | "quoteProps": "preserve" 13 | } 14 | }, 15 | { 16 | "files": ["*.yml"], 17 | "options": { 18 | "singleQuote": false 19 | } 20 | } 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /docs/images/bundler.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/divriots/browser-vite/5721afb654901fd14b629f0b4d7eafe4587ea189/docs/images/bundler.png -------------------------------------------------------------------------------- /docs/images/esm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/divriots/browser-vite/5721afb654901fd14b629f0b4d7eafe4587ea189/docs/images/esm.png -------------------------------------------------------------------------------- /docs/images/graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/divriots/browser-vite/5721afb654901fd14b629f0b4d7eafe4587ea189/docs/images/graph.png -------------------------------------------------------------------------------- /docs/images/vercel-configuration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/divriots/browser-vite/5721afb654901fd14b629f0b4d7eafe4587ea189/docs/images/vercel-configuration.png -------------------------------------------------------------------------------- /docs/images/vite-plugin-inspect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/divriots/browser-vite/5721afb654901fd14b629f0b4d7eafe4587ea189/docs/images/vite-plugin-inspect.png -------------------------------------------------------------------------------- /docs/public/_headers: -------------------------------------------------------------------------------- 1 | /assets/* 2 | cache-control: max-age=31536000 3 | cache-control: immutable 4 | 5 | /*.svg 6 | cache-control: max-age=604800 7 | cache-control: immutable 8 | 9 | /*.png 10 | cache-control: max-age=604800 11 | cache-control: immutable 12 | -------------------------------------------------------------------------------- /docs/public/divriots.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/divriots/browser-vite/5721afb654901fd14b629f0b4d7eafe4587ea189/docs/public/divriots.png -------------------------------------------------------------------------------- /docs/public/finclip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/divriots/browser-vite/5721afb654901fd14b629f0b4d7eafe4587ea189/docs/public/finclip.png -------------------------------------------------------------------------------- /docs/public/vite.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/divriots/browser-vite/5721afb654901fd14b629f0b4d7eafe4587ea189/docs/public/vite.mp3 -------------------------------------------------------------------------------- /docs/public/voice.svg: -------------------------------------------------------------------------------- 1 | 7 | -------------------------------------------------------------------------------- /docs/public/vuejobs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/divriots/browser-vite/5721afb654901fd14b629f0b4d7eafe4587ea189/docs/public/vuejobs.png -------------------------------------------------------------------------------- /netlify.toml: -------------------------------------------------------------------------------- 1 | [build.environment] 2 | NODE_VERSION = "16" 3 | NPM_FLAGS = "--version" # prevent Netlify npm install 4 | [build] 5 | publish = "docs/.vitepress/dist" 6 | command = "npx pnpm i --store=node_modules/.pnpm-store && npm run ci-docs" -------------------------------------------------------------------------------- /packages/create-app/README.md: -------------------------------------------------------------------------------- 1 | # @vitejs/create-app 2 | 3 | ## DEPRECATED 4 | 5 | Use `npm init vite` instead 6 | -------------------------------------------------------------------------------- /packages/create-vite/template-lit-ts/_gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | dist 4 | types 5 | *.local 6 | -------------------------------------------------------------------------------- /packages/create-vite/template-lit-ts/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Vite + Lit App 8 | 9 | 10 | 11 | 12 |

This is child content

13 |
14 | 15 | 16 | -------------------------------------------------------------------------------- /packages/create-vite/template-lit-ts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vite-lit-ts-starter", 3 | "version": "0.0.0", 4 | "main": "dist/my-element.es.js", 5 | "exports": { 6 | ".": "./dist/my-element.es.js" 7 | }, 8 | "types": "types/my-element.d.ts", 9 | "files": [ 10 | "dist", 11 | "types" 12 | ], 13 | "scripts": { 14 | "dev": "vite", 15 | "build": "tsc && vite build" 16 | }, 17 | "dependencies": { 18 | "lit": "^2.0.2" 19 | }, 20 | "devDependencies": { 21 | "vite": "^2.6.13", 22 | "typescript": "^4.4.4" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/create-vite/template-lit-ts/src/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /packages/create-vite/template-lit-ts/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite' 2 | 3 | // https://vitejs.dev/config/ 4 | export default defineConfig({ 5 | build: { 6 | lib: { 7 | entry: 'src/my-element.ts', 8 | formats: ['es'] 9 | }, 10 | rollupOptions: { 11 | external: /^lit/ 12 | } 13 | } 14 | }) 15 | -------------------------------------------------------------------------------- /packages/create-vite/template-lit/_gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | dist 4 | types 5 | *.local 6 | -------------------------------------------------------------------------------- /packages/create-vite/template-lit/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Vite + Lit App 8 | 9 | 10 | 11 | 12 |

This is child content

13 |
14 | 15 | 16 | -------------------------------------------------------------------------------- /packages/create-vite/template-lit/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vite-lit-starter", 3 | "version": "0.0.0", 4 | "main": "dist/my-element.es.js", 5 | "exports": { 6 | ".": "./dist/my-element.es.js" 7 | }, 8 | "files": [ 9 | "dist" 10 | ], 11 | "scripts": { 12 | "dev": "vite", 13 | "build": "vite build" 14 | }, 15 | "dependencies": { 16 | "lit": "^2.0.2" 17 | }, 18 | "devDependencies": { 19 | "vite": "^2.6.13" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/create-vite/template-lit/vite.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite' 2 | 3 | // https://vitejs.dev/config/ 4 | export default defineConfig({ 5 | build: { 6 | lib: { 7 | entry: 'src/my-element.js', 8 | formats: ['es'] 9 | }, 10 | rollupOptions: { 11 | external: /^lit/ 12 | } 13 | } 14 | }) 15 | -------------------------------------------------------------------------------- /packages/create-vite/template-preact-ts/_gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | dist 4 | dist-ssr 5 | *.local 6 | -------------------------------------------------------------------------------- /packages/create-vite/template-preact-ts/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Vite App 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /packages/create-vite/template-preact-ts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vite-preact-ts-starter", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "dev": "vite", 6 | "build": "tsc && vite build", 7 | "preview": "vite preview" 8 | }, 9 | "dependencies": { 10 | "preact": "^10.5.15" 11 | }, 12 | "devDependencies": { 13 | "@preact/preset-vite": "^2.1.5", 14 | "typescript": "^4.4.4", 15 | "vite": "^2.6.13" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/create-vite/template-preact-ts/src/app.tsx: -------------------------------------------------------------------------------- 1 | import { Logo } from './logo' 2 | 3 | export function App() { 4 | return ( 5 | <> 6 | 7 |

Hello Vite + Preact!

8 |

9 | 15 | Learn Preact 16 | 17 |

18 | 19 | ) 20 | } 21 | -------------------------------------------------------------------------------- /packages/create-vite/template-preact-ts/src/index.css: -------------------------------------------------------------------------------- 1 | html, 2 | body { 3 | height: 100%; 4 | width: 100%; 5 | padding: 0; 6 | margin: 0; 7 | background: #fafafa; 8 | font-family: 'Helvetica Neue', arial, sans-serif; 9 | font-weight: 400; 10 | color: #444; 11 | -webkit-font-smoothing: antialiased; 12 | -moz-osx-font-smoothing: grayscale; 13 | } 14 | 15 | * { 16 | box-sizing: border-box; 17 | } 18 | 19 | #app { 20 | height: 100%; 21 | text-align: center; 22 | background-color: #673ab8; 23 | color: #fff; 24 | font-size: 1.5em; 25 | padding-top: 100px; 26 | } 27 | 28 | .link { 29 | color: #fff; 30 | } 31 | -------------------------------------------------------------------------------- /packages/create-vite/template-preact-ts/src/main.tsx: -------------------------------------------------------------------------------- 1 | import { render } from 'preact' 2 | import { App } from './app' 3 | import './index.css' 4 | 5 | render(, document.getElementById('app')!) 6 | -------------------------------------------------------------------------------- /packages/create-vite/template-preact-ts/src/preact.d.ts: -------------------------------------------------------------------------------- 1 | import JSX = preact.JSX 2 | -------------------------------------------------------------------------------- /packages/create-vite/template-preact-ts/src/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /packages/create-vite/template-preact-ts/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite' 2 | import preact from '@preact/preset-vite' 3 | 4 | // https://vitejs.dev/config/ 5 | export default defineConfig({ 6 | plugins: [preact()] 7 | }) 8 | -------------------------------------------------------------------------------- /packages/create-vite/template-preact/_gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | dist 4 | dist-ssr 5 | *.local 6 | -------------------------------------------------------------------------------- /packages/create-vite/template-preact/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Vite App 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /packages/create-vite/template-preact/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vite-preact-starter", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "dev": "vite", 6 | "build": "vite build", 7 | "preview": "vite preview" 8 | }, 9 | "dependencies": { 10 | "preact": "^10.5.15" 11 | }, 12 | "devDependencies": { 13 | "@preact/preset-vite": "^2.1.5", 14 | "vite": "^2.6.13" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/create-vite/template-preact/src/app.jsx: -------------------------------------------------------------------------------- 1 | import { Logo } from './logo' 2 | 3 | export function App(props) { 4 | return ( 5 | <> 6 | 7 |

Hello Vite + Preact!

8 |

9 | 15 | Learn Preact 16 | 17 |

18 | 19 | ) 20 | } 21 | -------------------------------------------------------------------------------- /packages/create-vite/template-preact/src/main.jsx: -------------------------------------------------------------------------------- 1 | import { render } from 'preact' 2 | import { App } from './app' 3 | import './index.css' 4 | 5 | render(, document.getElementById('app')) 6 | -------------------------------------------------------------------------------- /packages/create-vite/template-preact/vite.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite' 2 | import preact from '@preact/preset-vite' 3 | 4 | // https://vitejs.dev/config/ 5 | export default defineConfig({ 6 | plugins: [preact()] 7 | }) 8 | -------------------------------------------------------------------------------- /packages/create-vite/template-react-ts/_gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | dist 4 | dist-ssr 5 | *.local 6 | -------------------------------------------------------------------------------- /packages/create-vite/template-react-ts/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Vite App 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /packages/create-vite/template-react-ts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vite-react-typescript-starter", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "dev": "vite", 6 | "build": "tsc && vite build", 7 | "preview": "vite preview" 8 | }, 9 | "dependencies": { 10 | "react": "^17.0.2", 11 | "react-dom": "^17.0.2" 12 | }, 13 | "devDependencies": { 14 | "@types/react": "^17.0.33", 15 | "@types/react-dom": "^17.0.10", 16 | "@vitejs/plugin-react": "^1.0.7", 17 | "typescript": "^4.4.4", 18 | "vite": "^2.6.13" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/create-vite/template-react-ts/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /packages/create-vite/template-react-ts/src/main.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import ReactDOM from 'react-dom' 3 | import './index.css' 4 | import App from './App' 5 | 6 | ReactDOM.render( 7 | 8 | 9 | , 10 | document.getElementById('root') 11 | ) 12 | -------------------------------------------------------------------------------- /packages/create-vite/template-react-ts/src/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /packages/create-vite/template-react-ts/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite' 2 | import react from '@vitejs/plugin-react' 3 | 4 | // https://vitejs.dev/config/ 5 | export default defineConfig({ 6 | plugins: [react()] 7 | }) 8 | -------------------------------------------------------------------------------- /packages/create-vite/template-react/_gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | dist 4 | dist-ssr 5 | *.local -------------------------------------------------------------------------------- /packages/create-vite/template-react/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Vite App 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /packages/create-vite/template-react/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vite-react-starter", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "dev": "vite", 6 | "build": "vite build", 7 | "preview": "vite preview" 8 | }, 9 | "dependencies": { 10 | "react": "^17.0.2", 11 | "react-dom": "^17.0.2" 12 | }, 13 | "devDependencies": { 14 | "@vitejs/plugin-react": "^1.0.7", 15 | "vite": "^2.6.13" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/create-vite/template-react/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /packages/create-vite/template-react/src/main.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import ReactDOM from 'react-dom' 3 | import './index.css' 4 | import App from './App' 5 | 6 | ReactDOM.render( 7 | 8 | 9 | , 10 | document.getElementById('root') 11 | ) 12 | -------------------------------------------------------------------------------- /packages/create-vite/template-react/vite.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite' 2 | import react from '@vitejs/plugin-react' 3 | 4 | // https://vitejs.dev/config/ 5 | export default defineConfig({ 6 | plugins: [react()] 7 | }) 8 | -------------------------------------------------------------------------------- /packages/create-vite/template-svelte-ts/.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": ["svelte.svelte-vscode"] 3 | } 4 | -------------------------------------------------------------------------------- /packages/create-vite/template-svelte-ts/_gitignore: -------------------------------------------------------------------------------- 1 | /node_modules/ 2 | /dist/ 3 | /.vscode/ 4 | .DS_Store 5 | -------------------------------------------------------------------------------- /packages/create-vite/template-svelte-ts/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Svelte + TS + Vite App 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /packages/create-vite/template-svelte-ts/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/divriots/browser-vite/5721afb654901fd14b629f0b4d7eafe4587ea189/packages/create-vite/template-svelte-ts/public/favicon.ico -------------------------------------------------------------------------------- /packages/create-vite/template-svelte-ts/src/assets/svelte.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/divriots/browser-vite/5721afb654901fd14b629f0b4d7eafe4587ea189/packages/create-vite/template-svelte-ts/src/assets/svelte.png -------------------------------------------------------------------------------- /packages/create-vite/template-svelte-ts/src/main.ts: -------------------------------------------------------------------------------- 1 | import App from './App.svelte' 2 | 3 | const app = new App({ 4 | target: document.getElementById('app') 5 | }) 6 | 7 | export default app 8 | -------------------------------------------------------------------------------- /packages/create-vite/template-svelte-ts/src/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | -------------------------------------------------------------------------------- /packages/create-vite/template-svelte-ts/svelte.config.js: -------------------------------------------------------------------------------- 1 | import sveltePreprocess from 'svelte-preprocess' 2 | 3 | export default { 4 | // Consult https://github.com/sveltejs/svelte-preprocess 5 | // for more information about preprocessors 6 | preprocess: sveltePreprocess() 7 | } 8 | -------------------------------------------------------------------------------- /packages/create-vite/template-svelte-ts/vite.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite' 2 | import { svelte } from '@sveltejs/vite-plugin-svelte' 3 | 4 | // https://vitejs.dev/config/ 5 | export default defineConfig({ 6 | plugins: [svelte()] 7 | }) 8 | -------------------------------------------------------------------------------- /packages/create-vite/template-svelte/.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": ["svelte.svelte-vscode"] 3 | } 4 | -------------------------------------------------------------------------------- /packages/create-vite/template-svelte/_gitignore: -------------------------------------------------------------------------------- 1 | /node_modules/ 2 | /dist/ 3 | /.vscode/ 4 | .DS_Store 5 | -------------------------------------------------------------------------------- /packages/create-vite/template-svelte/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Svelte + Vite App 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /packages/create-vite/template-svelte/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vite-svelte-starter", 3 | "version": "0.0.0", 4 | "type": "module", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "vite build", 8 | "preview": "vite preview" 9 | }, 10 | "devDependencies": { 11 | "@sveltejs/vite-plugin-svelte": "^1.0.0-next.30", 12 | "svelte": "^3.44.0", 13 | "vite": "^2.6.13" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/create-vite/template-svelte/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/divriots/browser-vite/5721afb654901fd14b629f0b4d7eafe4587ea189/packages/create-vite/template-svelte/public/favicon.ico -------------------------------------------------------------------------------- /packages/create-vite/template-svelte/src/assets/svelte.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/divriots/browser-vite/5721afb654901fd14b629f0b4d7eafe4587ea189/packages/create-vite/template-svelte/src/assets/svelte.png -------------------------------------------------------------------------------- /packages/create-vite/template-svelte/src/main.js: -------------------------------------------------------------------------------- 1 | import App from './App.svelte' 2 | 3 | const app = new App({ 4 | target: document.getElementById('app') 5 | }) 6 | 7 | export default app 8 | -------------------------------------------------------------------------------- /packages/create-vite/template-svelte/src/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | -------------------------------------------------------------------------------- /packages/create-vite/template-svelte/vite.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite' 2 | import { svelte } from '@sveltejs/vite-plugin-svelte' 3 | 4 | // https://vitejs.dev/config/ 5 | export default defineConfig({ 6 | plugins: [svelte()] 7 | }) 8 | -------------------------------------------------------------------------------- /packages/create-vite/template-vanilla-ts/_gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | dist 4 | dist-ssr 5 | *.local -------------------------------------------------------------------------------- /packages/create-vite/template-vanilla-ts/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Vite App 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /packages/create-vite/template-vanilla-ts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vite-typescript-starter", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "dev": "vite", 6 | "build": "tsc && vite build", 7 | "preview": "vite preview" 8 | }, 9 | "devDependencies": { 10 | "typescript": "^4.4.4", 11 | "vite": "^2.6.13" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/create-vite/template-vanilla-ts/src/main.ts: -------------------------------------------------------------------------------- 1 | import './style.css' 2 | 3 | const app = document.querySelector('#app')! 4 | 5 | app.innerHTML = ` 6 |

Hello Vite!

7 | Documentation 8 | ` 9 | -------------------------------------------------------------------------------- /packages/create-vite/template-vanilla-ts/src/style.css: -------------------------------------------------------------------------------- 1 | #app { 2 | font-family: Avenir, Helvetica, Arial, sans-serif; 3 | -webkit-font-smoothing: antialiased; 4 | -moz-osx-font-smoothing: grayscale; 5 | text-align: center; 6 | color: #2c3e50; 7 | margin-top: 60px; 8 | } 9 | -------------------------------------------------------------------------------- /packages/create-vite/template-vanilla-ts/src/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /packages/create-vite/template-vanilla-ts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "useDefineForClassFields": true, 5 | "module": "ESNext", 6 | "lib": ["ESNext", "DOM"], 7 | "moduleResolution": "Node", 8 | "strict": true, 9 | "sourceMap": true, 10 | "resolveJsonModule": true, 11 | "esModuleInterop": true, 12 | "noEmit": true, 13 | "noUnusedLocals": true, 14 | "noUnusedParameters": true, 15 | "noImplicitReturns": true 16 | }, 17 | "include": ["./src"] 18 | } 19 | -------------------------------------------------------------------------------- /packages/create-vite/template-vanilla/_gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | dist 4 | dist-ssr 5 | *.local -------------------------------------------------------------------------------- /packages/create-vite/template-vanilla/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Vite App 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /packages/create-vite/template-vanilla/main.js: -------------------------------------------------------------------------------- 1 | import './style.css' 2 | 3 | document.querySelector('#app').innerHTML = ` 4 |

Hello Vite!

5 | Documentation 6 | ` 7 | -------------------------------------------------------------------------------- /packages/create-vite/template-vanilla/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vite-starter", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "dev": "vite", 6 | "build": "vite build", 7 | "preview": "vite preview" 8 | }, 9 | "devDependencies": { 10 | "vite": "^2.6.13" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/create-vite/template-vanilla/style.css: -------------------------------------------------------------------------------- 1 | #app { 2 | font-family: Avenir, Helvetica, Arial, sans-serif; 3 | -webkit-font-smoothing: antialiased; 4 | -moz-osx-font-smoothing: grayscale; 5 | text-align: center; 6 | color: #2c3e50; 7 | margin-top: 60px; 8 | } 9 | -------------------------------------------------------------------------------- /packages/create-vite/template-vue-ts/.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": ["johnsoncodehk.volar"] 3 | } 4 | -------------------------------------------------------------------------------- /packages/create-vite/template-vue-ts/_gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | dist 4 | dist-ssr 5 | *.local 6 | -------------------------------------------------------------------------------- /packages/create-vite/template-vue-ts/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Vite App 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /packages/create-vite/template-vue-ts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vite-vue-typescript-starter", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "dev": "vite", 6 | "build": "vue-tsc --noEmit && vite build", 7 | "preview": "vite preview" 8 | }, 9 | "dependencies": { 10 | "vue": "^3.2.23" 11 | }, 12 | "devDependencies": { 13 | "@vitejs/plugin-vue": "^1.9.4", 14 | "typescript": "^4.4.4", 15 | "vite": "^2.6.13", 16 | "vue-tsc": "^0.28.10" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/create-vite/template-vue-ts/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/divriots/browser-vite/5721afb654901fd14b629f0b4d7eafe4587ea189/packages/create-vite/template-vue-ts/public/favicon.ico -------------------------------------------------------------------------------- /packages/create-vite/template-vue-ts/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/divriots/browser-vite/5721afb654901fd14b629f0b4d7eafe4587ea189/packages/create-vite/template-vue-ts/src/assets/logo.png -------------------------------------------------------------------------------- /packages/create-vite/template-vue-ts/src/env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | declare module '*.vue' { 4 | import { DefineComponent } from 'vue' 5 | // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types 6 | const component: DefineComponent<{}, {}, any> 7 | export default component 8 | } 9 | -------------------------------------------------------------------------------- /packages/create-vite/template-vue-ts/src/main.ts: -------------------------------------------------------------------------------- 1 | import { createApp } from 'vue' 2 | import App from './App.vue' 3 | 4 | createApp(App).mount('#app') 5 | -------------------------------------------------------------------------------- /packages/create-vite/template-vue-ts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "esnext", 4 | "useDefineForClassFields": true, 5 | "module": "esnext", 6 | "moduleResolution": "node", 7 | "strict": true, 8 | "jsx": "preserve", 9 | "sourceMap": true, 10 | "resolveJsonModule": true, 11 | "esModuleInterop": true, 12 | "lib": ["esnext", "dom"] 13 | }, 14 | "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"] 15 | } 16 | -------------------------------------------------------------------------------- /packages/create-vite/template-vue-ts/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite' 2 | import vue from '@vitejs/plugin-vue' 3 | 4 | // https://vitejs.dev/config/ 5 | export default defineConfig({ 6 | plugins: [vue()] 7 | }) 8 | -------------------------------------------------------------------------------- /packages/create-vite/template-vue/.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": ["johnsoncodehk.volar"] 3 | } 4 | -------------------------------------------------------------------------------- /packages/create-vite/template-vue/README.md: -------------------------------------------------------------------------------- 1 | # Vue 3 + Vite 2 | 3 | This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 ` 12 | 13 | 14 | -------------------------------------------------------------------------------- /packages/create-vite/template-vue/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vite-vue-starter", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "dev": "vite", 6 | "build": "vite build", 7 | "preview": "vite preview" 8 | }, 9 | "dependencies": { 10 | "vue": "^3.2.23" 11 | }, 12 | "devDependencies": { 13 | "@vitejs/plugin-vue": "^1.9.4", 14 | "vite": "^2.6.13" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/create-vite/template-vue/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/divriots/browser-vite/5721afb654901fd14b629f0b4d7eafe4587ea189/packages/create-vite/template-vue/public/favicon.ico -------------------------------------------------------------------------------- /packages/create-vite/template-vue/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/divriots/browser-vite/5721afb654901fd14b629f0b4d7eafe4587ea189/packages/create-vite/template-vue/src/assets/logo.png -------------------------------------------------------------------------------- /packages/create-vite/template-vue/src/main.js: -------------------------------------------------------------------------------- 1 | import { createApp } from 'vue' 2 | import App from './App.vue' 3 | 4 | createApp(App).mount('#app') 5 | -------------------------------------------------------------------------------- /packages/create-vite/template-vue/vite.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite' 2 | import vue from '@vitejs/plugin-vue' 3 | 4 | // https://vitejs.dev/config/ 5 | export default defineConfig({ 6 | plugins: [vue()] 7 | }) 8 | -------------------------------------------------------------------------------- /packages/playground/alias/dir/from-script-src.js: -------------------------------------------------------------------------------- 1 | document.querySelector('.from-script-src').textContent = 2 | '[success] from script src' 3 | -------------------------------------------------------------------------------- /packages/playground/alias/dir/module/index.js: -------------------------------------------------------------------------------- 1 | export const msg = `[success] aliased module` 2 | -------------------------------------------------------------------------------- /packages/playground/alias/dir/module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@vite/aliased-module", 3 | "private": true, 4 | "version": "0.0.0" 5 | } 6 | -------------------------------------------------------------------------------- /packages/playground/alias/dir/test.css: -------------------------------------------------------------------------------- 1 | body { 2 | color: grey; 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/alias/dir/test.js: -------------------------------------------------------------------------------- 1 | export const msg = `[success] alias to directory` 2 | -------------------------------------------------------------------------------- /packages/playground/alias/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-alias", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "vite build", 8 | "debug": "node --inspect-brk ../../vite/bin/vite", 9 | "preview": "vite preview", 10 | "postinstall": "node ../../../scripts/patchFileDeps.cjs" 11 | }, 12 | "dependencies": { 13 | "aliased-module": "file:./dir/module", 14 | "vue": "^3.2.23" 15 | }, 16 | "devDependencies": { 17 | "resolve-linked": "workspace:*" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/playground/alias/test.js: -------------------------------------------------------------------------------- 1 | export const msg = `[success] alias to fs path` 2 | -------------------------------------------------------------------------------- /packages/playground/assets/css/fonts.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'Inter'; 3 | font-style: italic; 4 | font-weight: 400; 5 | font-display: swap; 6 | src: url('../fonts/Inter-Italic.woff2?#iefix') format('woff2'), 7 | url('/fonts/Inter-Italic.woff') format('woff'); 8 | } 9 | 10 | body { 11 | font-family: 'Inter'; 12 | } 13 | -------------------------------------------------------------------------------- /packages/playground/assets/css/icons.css: -------------------------------------------------------------------------------- 1 | img { 2 | width: 32px; 3 | height: 32px; 4 | } 5 | 6 | .icon { 7 | display: inline-block; 8 | width: 32px; 9 | height: 32px; 10 | } 11 | 12 | .icon-clock { 13 | background: url(../nested/fragment-bg.svg#icon-clock-view) no-repeat; 14 | } 15 | 16 | .icon-heart { 17 | background: url(../nested/fragment-bg.svg#icon-heart-view) no-repeat; 18 | } 19 | 20 | .icon-arrow-right { 21 | background: url(../nested/fragment-bg.svg#icon-arrow-right-view) no-repeat; 22 | } 23 | -------------------------------------------------------------------------------- /packages/playground/assets/css/nested/at-imported-css-url.css: -------------------------------------------------------------------------------- 1 | .css-url-relative-at-imported { 2 | background: url(../../nested/asset.png); 3 | background-size: 10px; 4 | } 5 | -------------------------------------------------------------------------------- /packages/playground/assets/fonts/Inter-Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/divriots/browser-vite/5721afb654901fd14b629f0b4d7eafe4587ea189/packages/playground/assets/fonts/Inter-Italic.woff -------------------------------------------------------------------------------- /packages/playground/assets/fonts/Inter-Italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/divriots/browser-vite/5721afb654901fd14b629f0b4d7eafe4587ea189/packages/playground/assets/fonts/Inter-Italic.woff2 -------------------------------------------------------------------------------- /packages/playground/assets/foo.js: -------------------------------------------------------------------------------- 1 | console.log('hi') 2 | -------------------------------------------------------------------------------- /packages/playground/assets/nested/asset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/divriots/browser-vite/5721afb654901fd14b629f0b4d7eafe4587ea189/packages/playground/assets/nested/asset.png -------------------------------------------------------------------------------- /packages/playground/assets/nested/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/divriots/browser-vite/5721afb654901fd14b629f0b4d7eafe4587ea189/packages/playground/assets/nested/icon.png -------------------------------------------------------------------------------- /packages/playground/assets/nested/テスト-測試-white space.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/divriots/browser-vite/5721afb654901fd14b629f0b4d7eafe4587ea189/packages/playground/assets/nested/テスト-測試-white space.png -------------------------------------------------------------------------------- /packages/playground/assets/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-assets", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "vite build", 8 | "debug": "node --inspect-brk ../../vite/bin/vite", 9 | "preview": "vite preview" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/playground/assets/static/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/divriots/browser-vite/5721afb654901fd14b629f0b4d7eafe4587ea189/packages/playground/assets/static/icon.png -------------------------------------------------------------------------------- /packages/playground/assets/static/raw.css: -------------------------------------------------------------------------------- 1 | .raw-css { 2 | color: red; 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/assets/static/raw.js: -------------------------------------------------------------------------------- 1 | document.querySelector('.raw-js').textContent = 2 | '[success] Raw js from /public loaded' 3 | -------------------------------------------------------------------------------- /packages/playground/assets/vite.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | 3 | /** 4 | * @type {import('vite').UserConfig} 5 | */ 6 | module.exports = { 7 | base: '/foo/', 8 | publicDir: 'static', 9 | resolve: { 10 | alias: { 11 | '@': path.resolve(__dirname, 'nested') 12 | } 13 | }, 14 | build: { 15 | outDir: 'dist/foo', 16 | manifest: true, 17 | watch: {} 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/playground/assets/テスト-測試-white space.js: -------------------------------------------------------------------------------- 1 | console.log('test unicode') 2 | -------------------------------------------------------------------------------- /packages/playground/backend-integration/frontend/entrypoints/global.css: -------------------------------------------------------------------------------- 1 | @import '~/styles/background.css'; 2 | @import '~/styles/tailwind.css'; 3 | @import '../../references.css'; 4 | 5 | html, 6 | body { 7 | font-family: sans-serif; 8 | line-height: 2.4rem; 9 | } 10 | 11 | body { 12 | color: black; 13 | margin: 4vh auto; 14 | max-width: 800px; 15 | padding: 0 4vw; 16 | } 17 | 18 | ul { 19 | padding: 0 0.4em; 20 | margin: 0; 21 | } 22 | 23 | li { 24 | display: flex; 25 | align-items: center; 26 | } 27 | 28 | img { 29 | height: 32px; 30 | width: 32px; 31 | } 32 | -------------------------------------------------------------------------------- /packages/playground/backend-integration/frontend/entrypoints/main.ts: -------------------------------------------------------------------------------- 1 | export const colorClass = 'text-black' 2 | 3 | export function colorHeading() { 4 | document.querySelector('h1').className = colorClass 5 | } 6 | 7 | colorHeading() 8 | 9 | if (import.meta.hot) { 10 | import.meta.hot.accept() 11 | } 12 | -------------------------------------------------------------------------------- /packages/playground/backend-integration/frontend/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/divriots/browser-vite/5721afb654901fd14b629f0b4d7eafe4587ea189/packages/playground/backend-integration/frontend/images/logo.png -------------------------------------------------------------------------------- /packages/playground/backend-integration/frontend/styles/background.css: -------------------------------------------------------------------------------- 1 | .background-asset { 2 | background-repeat: no-repeat; 3 | background-size: 100%; 4 | display: inline-block; 5 | height: 32px; 6 | width: 32px; 7 | } 8 | 9 | .outside-root--aliased { 10 | background-image: url('~/images/logo.png'); 11 | } 12 | 13 | .outside-root--relative { 14 | background-image: url('../images/logo.png'); 15 | } 16 | -------------------------------------------------------------------------------- /packages/playground/backend-integration/frontend/styles/tailwind.css: -------------------------------------------------------------------------------- 1 | @tailwind utilities; 2 | -------------------------------------------------------------------------------- /packages/playground/backend-integration/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-backend-integration", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "vite build", 8 | "debug": "node --inspect-brk ../../vite/bin/vite", 9 | "preview": "vite preview" 10 | }, 11 | "dependencies": { 12 | "tailwindcss": "^2.2.19" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/playground/backend-integration/postcss.config.js: -------------------------------------------------------------------------------- 1 | // postcss.config.js 2 | module.exports = { 3 | plugins: { 4 | tailwindcss: { config: __dirname + '/tailwind.config.js' } 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/playground/backend-integration/references.css: -------------------------------------------------------------------------------- 1 | .asset-reference { 2 | display: grid; 3 | grid-template-areas: 4 | 'summary preview .' 5 | 'url url url'; 6 | } 7 | 8 | .asset-url { 9 | grid-area: url; 10 | white-space: nowrap; 11 | } 12 | -------------------------------------------------------------------------------- /packages/playground/backend-integration/tailwind.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | mode: 'jit', 3 | purge: [__dirname + '/frontend/**/*.{css,html,ts,js}'], 4 | darkMode: false, // or 'media' or 'class' 5 | theme: { 6 | extend: {} 7 | }, 8 | variants: { 9 | extend: {} 10 | }, 11 | plugins: [] 12 | } 13 | -------------------------------------------------------------------------------- /packages/playground/cli-module/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
vite cli in "type":"module" package works!
4 | -------------------------------------------------------------------------------- /packages/playground/cli-module/index.js: -------------------------------------------------------------------------------- 1 | console.log('vite cli in "type":"module" package works!') 2 | -------------------------------------------------------------------------------- /packages/playground/cli-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-cli-module", 3 | "private": true, 4 | "version": "0.0.0", 5 | "type": "module", 6 | "scripts": { 7 | "dev": "vite", 8 | "build": "vite build", 9 | "debug": "node --inspect-brk ../../vite/bin/vite", 10 | "serve": "vite preview" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/playground/cli-module/vite.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite' 2 | 3 | export default defineConfig({ 4 | server: { 5 | host: 'localhost' 6 | }, 7 | build: { 8 | //speed up build 9 | minify: false, 10 | target: 'esnext' 11 | } 12 | }) 13 | -------------------------------------------------------------------------------- /packages/playground/cli/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
vite cli works!
4 | -------------------------------------------------------------------------------- /packages/playground/cli/index.js: -------------------------------------------------------------------------------- 1 | console.log('vite cli works!') 2 | -------------------------------------------------------------------------------- /packages/playground/cli/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-cli", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "vite build", 8 | "debug": "node --inspect-brk ../../vite/bin/vite", 9 | "preview": "vite preview" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/playground/cli/vite.config.js: -------------------------------------------------------------------------------- 1 | const { defineConfig } = require('vite') 2 | 3 | module.exports = defineConfig({ 4 | server: { 5 | host: 'localhost' 6 | }, 7 | build: { 8 | //speed up build 9 | minify: false, 10 | target: 'esnext' 11 | } 12 | }) 13 | -------------------------------------------------------------------------------- /packages/playground/css-codesplit-cjs/index.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | -------------------------------------------------------------------------------- /packages/playground/css-codesplit-cjs/main.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | color: red; 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/css-codesplit-cjs/main.js: -------------------------------------------------------------------------------- 1 | import './style.css' 2 | import './main.css' 3 | 4 | document.getElementById( 5 | 'app' 6 | ).innerHTML = `

This should be red

This should be blue

` 7 | -------------------------------------------------------------------------------- /packages/playground/css-codesplit-cjs/other.js: -------------------------------------------------------------------------------- 1 | import './style.css' 2 | -------------------------------------------------------------------------------- /packages/playground/css-codesplit-cjs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-css-codesplit-cjs", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "vite build", 8 | "debug": "node --inspect-brk ../../vite/bin/vite", 9 | "preview": "vite preview" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/playground/css-codesplit-cjs/style.css: -------------------------------------------------------------------------------- 1 | h2 { 2 | color: blue; 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/css-codesplit-cjs/vite.config.js: -------------------------------------------------------------------------------- 1 | const { resolve } = require('path') 2 | 3 | module.exports = { 4 | build: { 5 | outDir: './dist', 6 | manifest: true, 7 | rollupOptions: { 8 | input: { 9 | main: resolve(__dirname, './index.html'), 10 | other: resolve(__dirname, './other.js') 11 | }, 12 | treeshake: false, 13 | output: { 14 | format: 'cjs', 15 | freeze: false, 16 | externalLiveBindings: false 17 | } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/playground/css-codesplit/index.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | -------------------------------------------------------------------------------- /packages/playground/css-codesplit/main.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | color: red; 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/css-codesplit/main.js: -------------------------------------------------------------------------------- 1 | import './style.css' 2 | import './main.css' 3 | 4 | document.getElementById( 5 | 'app' 6 | ).innerHTML = `

This should be red

This should be blue

` 7 | -------------------------------------------------------------------------------- /packages/playground/css-codesplit/other.js: -------------------------------------------------------------------------------- 1 | import './style.css' 2 | -------------------------------------------------------------------------------- /packages/playground/css-codesplit/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-css-codesplit", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "vite build", 8 | "debug": "node --inspect-brk ../../vite/bin/vite", 9 | "preview": "vite preview" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/playground/css-codesplit/style.css: -------------------------------------------------------------------------------- 1 | h2 { 2 | color: blue; 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/css-codesplit/vite.config.js: -------------------------------------------------------------------------------- 1 | const { resolve } = require('path') 2 | 3 | module.exports = { 4 | build: { 5 | manifest: true, 6 | rollupOptions: { 7 | input: { 8 | main: resolve(__dirname, './index.html'), 9 | other: resolve(__dirname, './other.js') 10 | } 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/playground/css/async-treeshaken.css: -------------------------------------------------------------------------------- 1 | .async-treeshaken { 2 | color: plum; 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/css/async-treeshaken.js: -------------------------------------------------------------------------------- 1 | import './async-treeshaken.css' 2 | 3 | const div = document.createElement('div') 4 | div.className = 'async-treeshaken' 5 | div.textContent = 6 | 'async treeshaken chunk (this should be plum and should not show up in prod)' 7 | document.body.appendChild(div) 8 | -------------------------------------------------------------------------------- /packages/playground/css/async.css: -------------------------------------------------------------------------------- 1 | .async { 2 | color: teal; 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/css/async.js: -------------------------------------------------------------------------------- 1 | import './async.css' 2 | 3 | const div = document.createElement('div') 4 | div.className = 'async' 5 | document.body.appendChild(div) 6 | div.textContent = `async chunk (this should be teal) ${ 7 | getComputedStyle(div).color 8 | }` 9 | -------------------------------------------------------------------------------- /packages/playground/css/composed.module.css: -------------------------------------------------------------------------------- 1 | .apply-color { 2 | color: turquoise; 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/css/composed.module.less: -------------------------------------------------------------------------------- 1 | .apply-color { 2 | color: blue; 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/css/composed.module.scss: -------------------------------------------------------------------------------- 1 | .apply-color { 2 | color: orangered; 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/css/composes-path-resolving.module.css: -------------------------------------------------------------------------------- 1 | .path-resolving-css { 2 | composes: apply-color from '@/composed.module.css'; 3 | } 4 | 5 | .path-resolving-sass { 6 | composes: apply-color from '@/composed.module.scss'; 7 | } 8 | 9 | .path-resolving-less { 10 | composes: apply-color from '@/composed.module.less'; 11 | } 12 | -------------------------------------------------------------------------------- /packages/playground/css/css-dep/index.css: -------------------------------------------------------------------------------- 1 | .css-dep { 2 | color: purple; 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/css/css-dep/index.js: -------------------------------------------------------------------------------- 1 | throw new Error('should not be imported') 2 | -------------------------------------------------------------------------------- /packages/playground/css/css-dep/index.scss: -------------------------------------------------------------------------------- 1 | .css-dep-sass { 2 | color: orange; 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/css/css-dep/index.styl: -------------------------------------------------------------------------------- 1 | .css-dep-stylus 2 | color red 3 | -------------------------------------------------------------------------------- /packages/playground/css/css-dep/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "css-dep", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "style": "index.css", 6 | "sass": "index.scss" 7 | } 8 | -------------------------------------------------------------------------------- /packages/playground/css/dep.css: -------------------------------------------------------------------------------- 1 | @import 'css-dep'; 2 | -------------------------------------------------------------------------------- /packages/playground/css/glob-dep.css: -------------------------------------------------------------------------------- 1 | @test; 2 | -------------------------------------------------------------------------------- /packages/playground/css/glob-dep/bar.css: -------------------------------------------------------------------------------- 1 | .dir-dep-2 { 2 | color: grey; 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/css/glob-dep/foo.css: -------------------------------------------------------------------------------- 1 | .dir-dep { 2 | color: grey; 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/css/imported-at-import.css: -------------------------------------------------------------------------------- 1 | .imported-at-import { 2 | color: purple; 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/css/imported.css: -------------------------------------------------------------------------------- 1 | @import './imported-at-import.css'; 2 | 3 | .imported { 4 | color: green; 5 | } 6 | 7 | pre { 8 | background-color: #eee; 9 | width: 500px; 10 | padding: 1em 1.5em; 11 | border-radius: 10px; 12 | } 13 | 14 | /* test postcss nesting */ 15 | .postcss { 16 | .nesting { 17 | color: pink; 18 | } 19 | } 20 | 21 | /* test url comma separation */ 22 | .url-separated { 23 | /* prettier-ignore */ 24 | background-image:url(images/cat.webp),url(images/dog.webp); 25 | } 26 | -------------------------------------------------------------------------------- /packages/playground/css/inlined.css: -------------------------------------------------------------------------------- 1 | .inlined { 2 | color: green; 3 | background: url('./ok.png'); 4 | } 5 | -------------------------------------------------------------------------------- /packages/playground/css/less.less: -------------------------------------------------------------------------------- 1 | @import '@/nested/nested'; 2 | 3 | @color: blue; 4 | 5 | .less { 6 | color: @color; 7 | } 8 | -------------------------------------------------------------------------------- /packages/playground/css/linked-at-import.css: -------------------------------------------------------------------------------- 1 | .linked-at-import { 2 | color: red; 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/css/linked.css: -------------------------------------------------------------------------------- 1 | @import '@/linked-at-import.css'; 2 | 3 | /* test postcss nesting */ 4 | .wrapper { 5 | .linked { 6 | color: blue; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/playground/css/minify.css: -------------------------------------------------------------------------------- 1 | .test-minify { 2 | color: rgba(255, 255, 0, 0.7); 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/css/mod.module.css: -------------------------------------------------------------------------------- 1 | .apply-color { 2 | color: turquoise; 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/css/mod.module.scss: -------------------------------------------------------------------------------- 1 | .apply-color { 2 | color: orangered; 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/css/nested/_index.scss: -------------------------------------------------------------------------------- 1 | .sass-at-import { 2 | color: olive; 3 | background: url(./icon.png) 10px no-repeat; 4 | } 5 | 6 | .sass-at-import-alias { 7 | color: olive; 8 | background: url(@/nested/icon.png) 10px no-repeat; 9 | } 10 | -------------------------------------------------------------------------------- /packages/playground/css/nested/_partial.scss: -------------------------------------------------------------------------------- 1 | .sass-partial { 2 | color: orchid; 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/css/nested/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/divriots/browser-vite/5721afb654901fd14b629f0b4d7eafe4587ea189/packages/playground/css/nested/icon.png -------------------------------------------------------------------------------- /packages/playground/css/nested/nested.less: -------------------------------------------------------------------------------- 1 | .less-at-import { 2 | color: darkslateblue; 3 | background: url(./icon.png) 10px no-repeat; 4 | } 5 | 6 | .less-at-import-alias { 7 | color: darkslateblue; 8 | background: url(@/nested/icon.png) 10px no-repeat; 9 | } 10 | -------------------------------------------------------------------------------- /packages/playground/css/nested/nested.styl: -------------------------------------------------------------------------------- 1 | .stylus-import 2 | color darkslateblue 3 | 4 | .stylus-import-alias 5 | color darkslateblue 6 | background url('@/nested/icon.png') 10px no-repeat 7 | -------------------------------------------------------------------------------- /packages/playground/css/ok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/divriots/browser-vite/5721afb654901fd14b629f0b4d7eafe4587ea189/packages/playground/css/ok.png -------------------------------------------------------------------------------- /packages/playground/css/options/absolute-import.styl: -------------------------------------------------------------------------------- 1 | .stylus-options-absolute-import 2 | /* imported via vite.config.js */ 3 | color red 4 | -------------------------------------------------------------------------------- /packages/playground/css/options/relative-import.styl: -------------------------------------------------------------------------------- 1 | .stylus-options-relative-import 2 | /* imported via vite.config.js */ 3 | color green 4 | -------------------------------------------------------------------------------- /packages/playground/css/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-css", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "vite build", 8 | "debug": "node --inspect-brk ../../vite/bin/vite", 9 | "preview": "vite preview" 10 | }, 11 | "devDependencies": { 12 | "css-dep": "link:./css-dep", 13 | "less": "^4.1.2", 14 | "postcss-nested": "^5.0.6", 15 | "sass": "^1.43.4", 16 | "stylus": "^0.55.0" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/playground/css/pkg-dep/_index.scss: -------------------------------------------------------------------------------- 1 | .sass-dep { 2 | color: lavender; 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/css/pkg-dep/index.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/divriots/browser-vite/5721afb654901fd14b629f0b4d7eafe4587ea189/packages/playground/css/pkg-dep/index.js -------------------------------------------------------------------------------- /packages/playground/css/pkg-dep/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dep", 3 | "version": "1.0.0", 4 | "main": "index.js" 5 | } 6 | -------------------------------------------------------------------------------- /packages/playground/css/postcss-caching/blue-app/imported.css: -------------------------------------------------------------------------------- 1 | .postcss-a { 2 | color: pink; 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/css/postcss-caching/blue-app/index.html: -------------------------------------------------------------------------------- 1 |
2 |

CSS

3 | 4 |

Imported css string:

5 |

 6 | 
 7 |   

This should be blue

8 | 9 |

This should be black

10 |
11 | 12 | 13 | -------------------------------------------------------------------------------- /packages/playground/css/postcss-caching/blue-app/main.js: -------------------------------------------------------------------------------- 1 | import css from './imported.css' 2 | text('.imported-css', css) 3 | 4 | function text(el, text) { 5 | document.querySelector(el).textContent = text 6 | } 7 | -------------------------------------------------------------------------------- /packages/playground/css/postcss-caching/blue-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "blue-app", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "vite build", 8 | "debug": "node --inspect-brk ../../vite/bin/vite", 9 | "preview": "vite preview" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/playground/css/postcss-caching/blue-app/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: [replacePinkWithBlue] 3 | } 4 | 5 | function replacePinkWithBlue() { 6 | return { 7 | postcssPlugin: 'replace-pink-with-blue', 8 | Declaration(decl) { 9 | if (decl.value === 'pink') { 10 | decl.value = 'blue' 11 | } 12 | } 13 | } 14 | } 15 | replacePinkWithBlue.postcss = true 16 | -------------------------------------------------------------------------------- /packages/playground/css/postcss-caching/green-app/imported.css: -------------------------------------------------------------------------------- 1 | .postcss-b { 2 | color: pink; 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/css/postcss-caching/green-app/index.html: -------------------------------------------------------------------------------- 1 |
2 |

CSS

3 | 4 |

Imported css string:

5 |

 6 | 
 7 |   

This should be black

8 | 9 |

This should be green

10 |
11 | 12 | 13 | -------------------------------------------------------------------------------- /packages/playground/css/postcss-caching/green-app/main.js: -------------------------------------------------------------------------------- 1 | import css from './imported.css' 2 | text('.imported-css', css) 3 | 4 | function text(el, text) { 5 | document.querySelector(el).textContent = text 6 | } 7 | -------------------------------------------------------------------------------- /packages/playground/css/postcss-caching/green-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "green-app", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "vite build", 8 | "debug": "node --inspect-brk ../../vite/bin/vite", 9 | "preview": "vite preview" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/playground/css/postcss-caching/green-app/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: [replacePinkWithGreen] 3 | } 4 | 5 | function replacePinkWithGreen() { 6 | return { 7 | postcssPlugin: 'replace-pink-with-green', 8 | Declaration(decl) { 9 | if (decl.value === 'pink') { 10 | decl.value = 'green' 11 | } 12 | } 13 | } 14 | } 15 | replacePinkWithGreen.postcss = true 16 | -------------------------------------------------------------------------------- /packages/playground/css/sass.scss: -------------------------------------------------------------------------------- 1 | @import '@/nested'; // alias + custom index resolving -> /nested/_index.scss 2 | @import '@/nested/partial'; // sass convention: omitting leading _ for partials 3 | @import 'css-dep'; // package w/ sass entry points 4 | @import 'virtual-dep'; // virtual file added through importer 5 | @import '@/pkg-dep'; // package w/out sass field 6 | 7 | .sass { 8 | /* injected via vite.config.js */ 9 | color: $injectedColor; 10 | } 11 | -------------------------------------------------------------------------------- /packages/playground/css/stylus.styl: -------------------------------------------------------------------------------- 1 | @import './nested/nested' 2 | @import 'css-dep'; // package w/ styl entry points 3 | 4 | $color ?= blue 5 | 6 | .stylus 7 | color $color 8 | 9 | .stylus-additional-data 10 | /* injected via vite.config.js */ 11 | color $injectedColor 12 | -------------------------------------------------------------------------------- /packages/playground/data-uri/__tests__/data-uri.spec.ts: -------------------------------------------------------------------------------- 1 | import { isBuild, findAssetFile } from '../../testUtils' 2 | 3 | test('plain', async () => { 4 | expect(await page.textContent('.plain')).toBe('hi') 5 | }) 6 | 7 | test('base64', async () => { 8 | expect(await page.textContent('.base64')).toBe('hi') 9 | }) 10 | 11 | if (isBuild) { 12 | test('should compile away the import for build', async () => { 13 | const file = findAssetFile('index') 14 | expect(file).not.toMatch('import') 15 | }) 16 | } 17 | -------------------------------------------------------------------------------- /packages/playground/data-uri/index.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 | 15 | -------------------------------------------------------------------------------- /packages/playground/data-uri/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-data-uri", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "vite build", 8 | "debug": "node --inspect-brk ../../vite/bin/vite", 9 | "preview": "vite preview" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/playground/define/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-define", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "vite build", 8 | "debug": "node --inspect-brk ../../vite/bin/vite", 9 | "preview": "vite preview" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/playground/define/vite.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | define: { 3 | __EXP__: '1 + 1', 4 | __STRING__: '"hello"', 5 | __NUMBER__: 123, 6 | __BOOLEAN__: true, 7 | __OBJ__: { 8 | foo: 1, 9 | bar: { 10 | baz: 2 11 | }, 12 | process: { 13 | env: { 14 | SOMEVAR: '"PROCESS MAY BE PROPERTY"' 15 | } 16 | } 17 | }, 18 | 'process.env.SOMEVAR': '"SOMEVAR"' 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/playground/dynamic-import/css/index.css: -------------------------------------------------------------------------------- 1 | .css { 2 | box-sizing: border-box; 3 | } 4 | .view { 5 | color: red; 6 | } 7 | -------------------------------------------------------------------------------- /packages/playground/dynamic-import/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | -------------------------------------------------------------------------------- /packages/playground/dynamic-import/mxd.js: -------------------------------------------------------------------------------- 1 | export default function () {} 2 | -------------------------------------------------------------------------------- /packages/playground/dynamic-import/mxd.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /packages/playground/dynamic-import/nested/shared.js: -------------------------------------------------------------------------------- 1 | export const n = 1 2 | -------------------------------------------------------------------------------- /packages/playground/dynamic-import/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-dynamic-import", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "vite build", 8 | "debug": "node --inspect-brk ../../vite/bin/vite", 9 | "preview": "vite preview" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/playground/dynamic-import/qux.js: -------------------------------------------------------------------------------- 1 | export const msg = 'Qux view' 2 | -------------------------------------------------------------------------------- /packages/playground/dynamic-import/views/bar.js: -------------------------------------------------------------------------------- 1 | export const msg = 'Bar view' 2 | -------------------------------------------------------------------------------- /packages/playground/dynamic-import/views/baz.js: -------------------------------------------------------------------------------- 1 | import { n } from '../nested/shared' 2 | console.log('baz' + n) 3 | 4 | export const msg = 'Baz view' 5 | -------------------------------------------------------------------------------- /packages/playground/dynamic-import/views/foo.js: -------------------------------------------------------------------------------- 1 | import { n } from '../nested/shared' 2 | console.log('foo' + n) 3 | 4 | export const msg = 'Foo view' 5 | -------------------------------------------------------------------------------- /packages/playground/env/.env: -------------------------------------------------------------------------------- 1 | VITE_CUSTOM_ENV_VARIABLE=1 2 | CUSTOM_PREFIX_ENV_VARIABLE=1 3 | VITE_EFFECTIVE_MODE_FILE_NAME=.env -------------------------------------------------------------------------------- /packages/playground/env/.env.development: -------------------------------------------------------------------------------- 1 | VITE_EFFECTIVE_MODE_FILE_NAME=.env.development 2 | -------------------------------------------------------------------------------- /packages/playground/env/.env.production: -------------------------------------------------------------------------------- 1 | VITE_EFFECTIVE_MODE_FILE_NAME=.env.production 2 | -------------------------------------------------------------------------------- /packages/playground/env/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-env", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "cross-env VITE_INLINE=inline-serve vite", 7 | "build": "cross-env VITE_INLINE=inline-build vite build", 8 | "debug": "node --inspect-brk ../../vite/bin/vite", 9 | "preview": "vite preview" 10 | }, 11 | "devDependencies": { 12 | "cross-env": "^7.0.3" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/playground/env/vite.config.js: -------------------------------------------------------------------------------- 1 | const { defineConfig } = require('vite') 2 | 3 | module.exports = defineConfig({ 4 | envPrefix: ['VITE_', 'CUSTOM_PREFIX_'] 5 | }) 6 | -------------------------------------------------------------------------------- /packages/playground/extensions/__tests__/extensions.spec.ts: -------------------------------------------------------------------------------- 1 | test('should have no 404s', () => { 2 | browserLogs.forEach((msg) => { 3 | expect(msg).not.toMatch('404') 4 | }) 5 | }) 6 | 7 | test('not contain `.mjs`', async () => { 8 | const appHtml = await page.content() 9 | expect(appHtml).toMatch('Hello Vite!') 10 | }) 11 | -------------------------------------------------------------------------------- /packages/playground/extensions/index.html: -------------------------------------------------------------------------------- 1 |
Hello Vite!
2 | 3 | 7 | -------------------------------------------------------------------------------- /packages/playground/extensions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-extensions", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "vite build", 8 | "debug": "node --inspect-brk ../../vite/bin/vite", 9 | "preview": "vite preview" 10 | }, 11 | "dependencies": { 12 | "vue": "^3.2.23" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/playground/extensions/vite.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | resolve: { 3 | alias: [{ find: 'vue', replacement: 'vue/dist/vue.esm-bundler.js' }], 4 | extensions: ['.js'] 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/playground/file-delete-restore/App.jsx: -------------------------------------------------------------------------------- 1 | import { useState } from 'react' 2 | import Child from './Child' 3 | 4 | function App() { 5 | return ( 6 |
7 | 8 |
9 | ) 10 | } 11 | 12 | export default App 13 | -------------------------------------------------------------------------------- /packages/playground/file-delete-restore/Child.jsx: -------------------------------------------------------------------------------- 1 | export default function Child() { 2 | return

Child state 1

3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/file-delete-restore/index.html: -------------------------------------------------------------------------------- 1 |
2 | 9 | -------------------------------------------------------------------------------- /packages/playground/file-delete-restore/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-file-delete-restore", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "vite build", 8 | "debug": "node --inspect-brk ../../vite/bin/vite", 9 | "preview": "vite preview" 10 | }, 11 | "dependencies": { 12 | "react": "^17.0.2", 13 | "react-dom": "^17.0.2" 14 | }, 15 | "devDependencies": { 16 | "@vitejs/plugin-react": "workspace:*" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/playground/file-delete-restore/vite.config.js: -------------------------------------------------------------------------------- 1 | const react = require('@vitejs/plugin-react') 2 | 3 | /** 4 | * @type {import('vite').UserConfig} 5 | */ 6 | module.exports = { 7 | plugins: [react()], 8 | build: { 9 | // to make tests faster 10 | minify: false 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/playground/fs-serve/entry.js: -------------------------------------------------------------------------------- 1 | import { msg } from './nested/foo' 2 | 3 | export const fullmsg = msg + 'bar' 4 | 5 | document.querySelector('.nested-entry').textContent = fullmsg 6 | -------------------------------------------------------------------------------- /packages/playground/fs-serve/nested/foo.js: -------------------------------------------------------------------------------- 1 | export const msg = 'foo' 2 | -------------------------------------------------------------------------------- /packages/playground/fs-serve/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-fs-serve", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "vite root", 7 | "build": "vite build root", 8 | "debug": "node --inspect-brk ../../vite/bin/vite", 9 | "preview": "vite preview" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/playground/fs-serve/root/src/.env: -------------------------------------------------------------------------------- 1 | KEY=unsafe 2 | -------------------------------------------------------------------------------- /packages/playground/fs-serve/root/src/safe.txt: -------------------------------------------------------------------------------- 1 | KEY=safe 2 | -------------------------------------------------------------------------------- /packages/playground/fs-serve/root/unsafe.txt: -------------------------------------------------------------------------------- 1 | KEY=unsafe 2 | -------------------------------------------------------------------------------- /packages/playground/fs-serve/root/vite.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | 3 | /** 4 | * @type {import('vite').UserConfig} 5 | */ 6 | module.exports = { 7 | build: { 8 | rollupOptions: { 9 | input: { 10 | main: path.resolve(__dirname, 'src/index.html') 11 | } 12 | } 13 | }, 14 | server: { 15 | fs: { 16 | strict: true, 17 | allow: [path.resolve(__dirname, 'src')] 18 | }, 19 | hmr: { 20 | overlay: false 21 | } 22 | }, 23 | define: { 24 | ROOT: JSON.stringify(path.dirname(__dirname).replace(/\\/g, '/')) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /packages/playground/fs-serve/safe.json: -------------------------------------------------------------------------------- 1 | { 2 | "msg": "safe" 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/fs-serve/unsafe.json: -------------------------------------------------------------------------------- 1 | { 2 | "msg": "unsafe" 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/glob-import/dir/baz.json: -------------------------------------------------------------------------------- 1 | { 2 | "msg": "baz" 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/glob-import/dir/foo.js: -------------------------------------------------------------------------------- 1 | export const msg = 'foo' 2 | -------------------------------------------------------------------------------- /packages/playground/glob-import/dir/index.js: -------------------------------------------------------------------------------- 1 | const modules = import.meta.globEager('./*.(js|ts)') 2 | 3 | export { modules } 4 | -------------------------------------------------------------------------------- /packages/playground/glob-import/dir/nested/bar.js: -------------------------------------------------------------------------------- 1 | const modules = import.meta.globEager('../*.json') 2 | 3 | export const msg = 'bar' 4 | export { modules } 5 | -------------------------------------------------------------------------------- /packages/playground/glob-import/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-import-context", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "vite build", 8 | "debug": "node --inspect-brk ../../vite/bin/vite", 9 | "preview": "vite preview" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/playground/hmr/customFile.js: -------------------------------------------------------------------------------- 1 | export const msg = 'custom' 2 | -------------------------------------------------------------------------------- /packages/playground/hmr/hmrDep.js: -------------------------------------------------------------------------------- 1 | export const foo = 1 2 | export { foo as nestedFoo } from './hmrNestedDep' 3 | 4 | if (import.meta.hot) { 5 | const data = import.meta.hot.data 6 | if ('fromDispose' in data) { 7 | console.log(`(dep) foo from dispose: ${data.fromDispose}`) 8 | } 9 | 10 | import.meta.hot.dispose((data) => { 11 | console.log(`(dep) foo was: ${foo}`) 12 | data.fromDispose = foo 13 | }) 14 | } 15 | -------------------------------------------------------------------------------- /packages/playground/hmr/hmrNestedDep.js: -------------------------------------------------------------------------------- 1 | export const foo = 1 2 | -------------------------------------------------------------------------------- /packages/playground/hmr/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |
5 |
6 |
7 | -------------------------------------------------------------------------------- /packages/playground/hmr/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-hmr", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "vite build", 8 | "debug": "node --inspect-brk ../../vite/bin/vite", 9 | "preview": "vite preview" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/playground/hmr/vite.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @type {import('vite').UserConfig} 3 | */ 4 | module.exports = { 5 | plugins: [ 6 | { 7 | name: 'mock-custom', 8 | async handleHotUpdate({ file, read, server }) { 9 | if (file.endsWith('customFile.js')) { 10 | const content = await read() 11 | const msg = content.match(/export const msg = '(\w+)'/)[1] 12 | server.ws.send({ 13 | type: 'custom', 14 | event: 'foo', 15 | data: { 16 | msg 17 | } 18 | }) 19 | } 20 | } 21 | } 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /packages/playground/html/common.css: -------------------------------------------------------------------------------- 1 | p { 2 | color: grey; 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/html/foo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | About 8 | 9 | 10 |

Foo.html

11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /packages/playground/html/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

Hello

5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /packages/playground/html/inline/common.js: -------------------------------------------------------------------------------- 1 | import './dep1' 2 | import './dep2' 3 | 4 | export function log(name) { 5 | document.getElementById('output').innerHTML += name + ' ' 6 | } 7 | 8 | log('common') 9 | -------------------------------------------------------------------------------- /packages/playground/html/inline/dep1.js: -------------------------------------------------------------------------------- 1 | import { log } from './common' 2 | 3 | log('dep1') 4 | -------------------------------------------------------------------------------- /packages/playground/html/inline/dep2.js: -------------------------------------------------------------------------------- 1 | import { log } from './common' 2 | 3 | log('dep2') 4 | -------------------------------------------------------------------------------- /packages/playground/html/inline/dep3.js: -------------------------------------------------------------------------------- 1 | import './dep2' 2 | import { log } from './common' 3 | 4 | log('dep3') 5 | -------------------------------------------------------------------------------- /packages/playground/html/inline/module-graph.dot: -------------------------------------------------------------------------------- 1 | digraph Module { 2 | common -> { dep1, dep2 } [style=dashed,color=grey] 3 | dep1 -> common 4 | dep2 -> common 5 | dep3 -> { dep2, common } 6 | 7 | subgraph shared { 8 | shared [style=filled] 9 | shared -> { dep3, common } 10 | } 11 | 12 | subgraph unique { 13 | unique [style=filled] 14 | unique -> { common, dep2 } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/playground/html/inline/shared-1.html: -------------------------------------------------------------------------------- 1 |

2 | 
3 | 


--------------------------------------------------------------------------------
/packages/playground/html/inline/shared-2.html:
--------------------------------------------------------------------------------
1 | 

2 | 
3 | 


--------------------------------------------------------------------------------
/packages/playground/html/inline/shared.js:
--------------------------------------------------------------------------------
1 | import './dep3'
2 | import { log } from './common'
3 | 
4 | log('shared')
5 | 


--------------------------------------------------------------------------------
/packages/playground/html/inline/unique.html:
--------------------------------------------------------------------------------
1 | 

2 | 
3 | 


--------------------------------------------------------------------------------
/packages/playground/html/inline/unique.js:
--------------------------------------------------------------------------------
1 | import { log } from './common'
2 | import './dep2'
3 | 
4 | log('unique')
5 | 


--------------------------------------------------------------------------------
/packages/playground/html/main.css:
--------------------------------------------------------------------------------
1 | h1 {
2 |   color: blue;
3 | }
4 | 


--------------------------------------------------------------------------------
/packages/playground/html/main.js:
--------------------------------------------------------------------------------
1 | import { msg } from './shared'
2 | import './common.css'
3 | 
4 | console.log(msg + ' from main')
5 | 


--------------------------------------------------------------------------------
/packages/playground/html/nested/index.html:
--------------------------------------------------------------------------------
1 | 
2 | 

Nested

3 | 4 | -------------------------------------------------------------------------------- /packages/playground/html/nested/nested.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | color: red; 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/html/nested/nested.js: -------------------------------------------------------------------------------- 1 | import { msg } from '../shared' 2 | import '../common.css' 3 | 4 | console.log(msg + ' from nested') 5 | -------------------------------------------------------------------------------- /packages/playground/html/noBody.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

Hello

5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /packages/playground/html/noHead.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

Hello

5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /packages/playground/html/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-html", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "vite build", 8 | "debug": "node --inspect-brk ../../vite/bin/vite", 9 | "preview": "vite preview" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/playground/html/scriptAsync.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

scriptAsync.html

4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /packages/playground/html/scriptMixed.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

scriptMixed.html

4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /packages/playground/html/shared.js: -------------------------------------------------------------------------------- 1 | export const msg = 'shared' 2 | -------------------------------------------------------------------------------- /packages/playground/html/unicode-path/中文-にほんご-한글-🌕🌖🌗/index.html: -------------------------------------------------------------------------------- 1 |

unicode-path

2 | -------------------------------------------------------------------------------- /packages/playground/html/zeroJS.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

zeroJS.html

4 | 5 | 10 | -------------------------------------------------------------------------------- /packages/playground/json/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-json", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "vite build", 8 | "debug": "node --inspect-brk ../../vite/bin/vite", 9 | "preview": "vite preview" 10 | }, 11 | "devDependencies": { 12 | "vue": "^3.2.23" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/playground/json/public/public.json: -------------------------------------------------------------------------------- 1 | { 2 | "hello": "this is json" 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/json/test.json: -------------------------------------------------------------------------------- 1 | { 2 | "hello": "this is json" 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/legacy/async.js: -------------------------------------------------------------------------------- 1 | export function fn() { 2 | const m = new Map() 3 | m.set('foo', 'Hello') 4 | document.querySelector('#app').textContent = m.get('foo') 5 | } 6 | -------------------------------------------------------------------------------- /packages/playground/legacy/entry-server.js: -------------------------------------------------------------------------------- 1 | // This counts as 'server-side' rendering, yes? 2 | export async function render() { 3 | return /* html */ ` 4 |
Hello
5 |
${import.meta.env.LEGACY}
6 | ` 7 | } 8 | -------------------------------------------------------------------------------- /packages/playground/legacy/immutable-chunk.js: -------------------------------------------------------------------------------- 1 | const chunks = [ 2 | 'index', 3 | 'index-legacy', 4 | 'chunk-async', 5 | 'chunk-async-legacy', 6 | 'immutable-chunk', 7 | 'immutable-chunk-legacy', 8 | 'polyfills-legacy' 9 | ] 10 | 11 | export function fn() { 12 | return Promise.all( 13 | chunks.map(async (name) => { 14 | const response = await fetch(`/assets/${name}.js`) 15 | return `${name}: ${response.status}` 16 | }) 17 | ) 18 | } 19 | -------------------------------------------------------------------------------- /packages/playground/legacy/index.html: -------------------------------------------------------------------------------- 1 |

2 |
3 |
4 |
5 |
6 | 7 | -------------------------------------------------------------------------------- /packages/playground/legacy/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-legacy", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "vite build --debug legacy", 8 | "build:custom-filename": "vite --config ./vite.config-custom-filename.js build --debug legacy", 9 | "debug": "node --inspect-brk ../../vite/bin/vite", 10 | "preview": "vite preview" 11 | }, 12 | "devDependencies": { 13 | "@vitejs/plugin-legacy": "workspace:*" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/playground/legacy/vite.config-custom-filename.js: -------------------------------------------------------------------------------- 1 | const legacy = require('@vitejs/plugin-legacy').default 2 | 3 | module.exports = { 4 | plugins: [legacy()], 5 | build: { 6 | manifest: true, 7 | minify: false, 8 | rollupOptions: { 9 | output: { 10 | entryFileNames: `assets/[name].js`, 11 | chunkFileNames: `assets/[name].js` 12 | } 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/playground/lib/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 10 | -------------------------------------------------------------------------------- /packages/playground/lib/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@example/my-lib", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "vite build", 8 | "debug": "node --inspect-brk ../../vite/bin/vite", 9 | "preview": "vite preview" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/playground/lib/src/main.js: -------------------------------------------------------------------------------- 1 | export default function myLib(sel) { 2 | document.querySelector(sel).textContent = 'It works' 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/lib/src/main2.js: -------------------------------------------------------------------------------- 1 | export default async function message(sel) { 2 | const message = await import('./message.js') 3 | document.querySelector(sel).textContent = message.default 4 | } 5 | -------------------------------------------------------------------------------- /packages/playground/lib/src/message.js: -------------------------------------------------------------------------------- 1 | export default 'hello vite' 2 | -------------------------------------------------------------------------------- /packages/playground/lib/vite.dyimport.config.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs') 2 | const path = require('path') 3 | 4 | /** 5 | * @type {import('vite').UserConfig} 6 | */ 7 | module.exports = { 8 | build: { 9 | minify: false, 10 | lib: { 11 | entry: path.resolve(__dirname, 'src/main2.js'), 12 | formats: ['es'], 13 | name: 'message', 14 | fileName: () => 'dynamic-import-message.js' 15 | }, 16 | outDir: 'dist/lib' 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/playground/multiple-entrypoints/__tests__/multiple-entrypoints.spec.ts: -------------------------------------------------------------------------------- 1 | import { getColor, untilUpdated } from '../../testUtils' 2 | 3 | test('should have css applied on second dynamic import', async () => { 4 | await untilUpdated(() => page.textContent('.content'), 'Initial', true) 5 | await page.click('.b') 6 | 7 | await untilUpdated(() => page.textContent('.content'), 'Reference', true) 8 | expect(await getColor('.content')).toBe('red') 9 | }) 10 | -------------------------------------------------------------------------------- /packages/playground/multiple-entrypoints/dynamic-a.js: -------------------------------------------------------------------------------- 1 | import './reference' 2 | -------------------------------------------------------------------------------- /packages/playground/multiple-entrypoints/dynamic-b.js: -------------------------------------------------------------------------------- 1 | import './reference' 2 | -------------------------------------------------------------------------------- /packages/playground/multiple-entrypoints/entrypoints/a15.js: -------------------------------------------------------------------------------- 1 | import a16 from './a16' 2 | import a17 from './a17' 3 | import a18 from './a18' 4 | import a19 from './a19' 5 | import a20 from './a20' 6 | import a21 from './a21' 7 | import a22 from './a22' 8 | import a23 from './a23' 9 | import a24 from './a24' 10 | 11 | export const that = () => import('./a14.js') 12 | 13 | export function other() { 14 | return a16() + a17() + a18() + a19() + a20() + a21() + a22() + a23() + a24() 15 | } 16 | 17 | export default function () { 18 | return 123 19 | } 20 | -------------------------------------------------------------------------------- /packages/playground/multiple-entrypoints/entrypoints/a16.js: -------------------------------------------------------------------------------- 1 | import a17 from './a17' 2 | import a18 from './a18' 3 | import a19 from './a19' 4 | import a20 from './a20' 5 | import a21 from './a21' 6 | import a22 from './a22' 7 | import a23 from './a23' 8 | import a24 from './a24' 9 | 10 | export const that = () => import('./a15.js') 11 | 12 | export function other() { 13 | return a17() + a18() + a19() + a20() + a21() + a22() + a23() + a24() 14 | } 15 | 16 | export default function () { 17 | return 123 18 | } 19 | -------------------------------------------------------------------------------- /packages/playground/multiple-entrypoints/entrypoints/a17.js: -------------------------------------------------------------------------------- 1 | import a18 from './a18' 2 | import a19 from './a19' 3 | import a20 from './a20' 4 | import a21 from './a21' 5 | import a22 from './a22' 6 | import a23 from './a23' 7 | import a24 from './a24' 8 | 9 | export const that = () => import('./a16.js') 10 | 11 | export function other() { 12 | return a18() + a19() + a20() + a21() + a22() + a23() + a24() 13 | } 14 | 15 | export default function () { 16 | return 123 17 | } 18 | -------------------------------------------------------------------------------- /packages/playground/multiple-entrypoints/entrypoints/a18.js: -------------------------------------------------------------------------------- 1 | import a19 from './a19' 2 | import a20 from './a20' 3 | import a21 from './a21' 4 | import a22 from './a22' 5 | import a23 from './a23' 6 | import a24 from './a24' 7 | 8 | export const that = () => import('./a17.js') 9 | 10 | export function other() { 11 | return a19() + a20() + a21() + a22() + a23() + a24() 12 | } 13 | 14 | export default function () { 15 | return 123 16 | } 17 | -------------------------------------------------------------------------------- /packages/playground/multiple-entrypoints/entrypoints/a19.js: -------------------------------------------------------------------------------- 1 | import a20 from './a20' 2 | import a21 from './a21' 3 | import a22 from './a22' 4 | import a23 from './a23' 5 | import a24 from './a24' 6 | 7 | export const that = () => import('./a18.js') 8 | 9 | export function other() { 10 | return a20() + a21() + a22() + a23() + a24() 11 | } 12 | 13 | export default function () { 14 | return 123 15 | } 16 | -------------------------------------------------------------------------------- /packages/playground/multiple-entrypoints/entrypoints/a20.js: -------------------------------------------------------------------------------- 1 | import a21 from './a21' 2 | import a22 from './a22' 3 | import a23 from './a23' 4 | import a24 from './a24' 5 | 6 | export const that = () => import('./a19.js') 7 | 8 | export function other() { 9 | return a21() + a22() + a23() + a24() 10 | } 11 | 12 | export default function () { 13 | return 123 14 | } 15 | -------------------------------------------------------------------------------- /packages/playground/multiple-entrypoints/entrypoints/a21.js: -------------------------------------------------------------------------------- 1 | import a22 from './a22' 2 | import a23 from './a23' 3 | import a24 from './a24' 4 | 5 | export const that = () => import('./a20.js') 6 | 7 | export function other() { 8 | return a22() + a23() + a24() 9 | } 10 | 11 | export default function () { 12 | return 123 13 | } 14 | -------------------------------------------------------------------------------- /packages/playground/multiple-entrypoints/entrypoints/a22.js: -------------------------------------------------------------------------------- 1 | import a23 from './a23' 2 | import a24 from './a24' 3 | 4 | export const that = () => import('./a21.js') 5 | 6 | export function other() { 7 | return a23() + a24() 8 | } 9 | 10 | export default function () { 11 | return 123 12 | } 13 | -------------------------------------------------------------------------------- /packages/playground/multiple-entrypoints/entrypoints/a23.js: -------------------------------------------------------------------------------- 1 | import a24 from './a24' 2 | 3 | export const that = () => import('./a22.js') 4 | 5 | export function other() { 6 | return a24() 7 | } 8 | 9 | export default function () { 10 | return 123 11 | } 12 | -------------------------------------------------------------------------------- /packages/playground/multiple-entrypoints/entrypoints/a24.js: -------------------------------------------------------------------------------- 1 | export const that = () => import('./a23.js') 2 | 3 | export function other() { 4 | return 5 | } 6 | 7 | export default function () { 8 | return 123 9 | } 10 | -------------------------------------------------------------------------------- /packages/playground/multiple-entrypoints/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
Initial
6 | -------------------------------------------------------------------------------- /packages/playground/multiple-entrypoints/index.js: -------------------------------------------------------------------------------- 1 | document 2 | .querySelector('.a') 3 | .addEventListener('click', () => import('./dynamic-a')) 4 | document 5 | .querySelector('.b') 6 | .addEventListener('click', () => import('./dynamic-b')) 7 | -------------------------------------------------------------------------------- /packages/playground/multiple-entrypoints/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multiple-entrypoints", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "vite build", 8 | "debug": "node --inspect-brk ../../vite/bin/vite", 9 | "preview": "vite preview" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/playground/multiple-entrypoints/reference.js: -------------------------------------------------------------------------------- 1 | import './reference.scss' 2 | 3 | document.querySelector('.content').textContent = 'Reference' 4 | -------------------------------------------------------------------------------- /packages/playground/multiple-entrypoints/reference.scss: -------------------------------------------------------------------------------- 1 | .content { 2 | color: red; 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/nested-deps/__tests__/nested-deps.spec.ts: -------------------------------------------------------------------------------- 1 | test('handle nested package', async () => { 2 | expect(await page.textContent('.a')).toBe('A@2.0.0') 3 | expect(await page.textContent('.b')).toBe('B@1.0.0') 4 | expect(await page.textContent('.nested-a')).toBe('A@1.0.0') 5 | const c = await page.textContent('.c') 6 | expect(c).toBe('es-C@1.0.0') 7 | expect(await page.textContent('.side-c')).toBe(c) 8 | expect(await page.textContent('.d')).toBe('D@1.0.0') 9 | expect(await page.textContent('.nested-d')).toBe('D-nested@1.0.0') 10 | expect(await page.textContent('.nested-e')).toBe('1') 11 | }) 12 | -------------------------------------------------------------------------------- /packages/playground/nested-deps/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@test/nested-deps", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "vite build", 8 | "debug": "node --inspect-brk ../../vite/bin/vite", 9 | "preview": "vite preview" 10 | }, 11 | "dependencies": { 12 | "test-package-a": "link:./test-package-a", 13 | "test-package-b": "link:./test-package-b", 14 | "test-package-c": "link:./test-package-c", 15 | "test-package-d": "link:./test-package-d", 16 | "test-package-e": "link:./test-package-e" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/playground/nested-deps/test-package-a/index.js: -------------------------------------------------------------------------------- 1 | export default 'A@2.0.0' 2 | -------------------------------------------------------------------------------- /packages/playground/nested-deps/test-package-a/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-package-a", 3 | "version": "2.0.0", 4 | "main": "index.js" 5 | } 6 | -------------------------------------------------------------------------------- /packages/playground/nested-deps/test-package-b/index.js: -------------------------------------------------------------------------------- 1 | export { default as A } from 'test-package-a' 2 | 3 | export default 'B@1.0.0' 4 | -------------------------------------------------------------------------------- /packages/playground/nested-deps/test-package-b/node_modules/test-package-a/index.js: -------------------------------------------------------------------------------- 1 | export default 'A@1.0.0' 2 | -------------------------------------------------------------------------------- /packages/playground/nested-deps/test-package-b/node_modules/test-package-a/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-package-a", 3 | "version": "1.0.0", 4 | "main": "index.js" 5 | } 6 | -------------------------------------------------------------------------------- /packages/playground/nested-deps/test-package-b/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-package-b", 3 | "version": "1.0.0", 4 | "main": "index.js" 5 | } 6 | -------------------------------------------------------------------------------- /packages/playground/nested-deps/test-package-c/index-es.js: -------------------------------------------------------------------------------- 1 | export default 'es-C@1.0.0' 2 | -------------------------------------------------------------------------------- /packages/playground/nested-deps/test-package-c/index.js: -------------------------------------------------------------------------------- 1 | // this module should not be resolved 2 | export default 'C@1.0.0' 3 | -------------------------------------------------------------------------------- /packages/playground/nested-deps/test-package-c/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-package-c", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "module": "index-es.js" 6 | } 7 | -------------------------------------------------------------------------------- /packages/playground/nested-deps/test-package-c/side.js: -------------------------------------------------------------------------------- 1 | export { default as C } from 'test-package-c' 2 | -------------------------------------------------------------------------------- /packages/playground/nested-deps/test-package-d/index.js: -------------------------------------------------------------------------------- 1 | export { default as nestedD } from 'test-package-d-nested' 2 | 3 | export default 'D@1.0.0' 4 | -------------------------------------------------------------------------------- /packages/playground/nested-deps/test-package-d/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-package-d", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "dependencies": { 6 | "test-package-d-nested": "link:./test-package-d-nested" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/playground/nested-deps/test-package-d/test-package-d-nested/index.js: -------------------------------------------------------------------------------- 1 | export default 'D-nested@1.0.0' 2 | -------------------------------------------------------------------------------- /packages/playground/nested-deps/test-package-d/test-package-d-nested/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-package-d-nested", 3 | "version": "1.0.0", 4 | "main": "index.js" 5 | } 6 | -------------------------------------------------------------------------------- /packages/playground/nested-deps/test-package-e/index.js: -------------------------------------------------------------------------------- 1 | export { testIncluded } from 'test-package-e-included' 2 | export { testExcluded } from 'test-package-e-excluded' 3 | -------------------------------------------------------------------------------- /packages/playground/nested-deps/test-package-e/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-package-e", 3 | "version": "0.1.0", 4 | "main": "index.js", 5 | "dependencies": { 6 | "test-package-e-excluded": "link:./test-package-e-excluded", 7 | "test-package-e-included": "link:./test-package-e-included" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/playground/nested-deps/test-package-e/test-package-e-excluded/index.js: -------------------------------------------------------------------------------- 1 | const key = '$$excludedDependencyInstanceCount' 2 | 3 | if (!(key in window)) { 4 | window[key] = 0 5 | } 6 | 7 | ++window[key] 8 | 9 | export function testExcluded() { 10 | return window[key] 11 | } 12 | -------------------------------------------------------------------------------- /packages/playground/nested-deps/test-package-e/test-package-e-excluded/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-package-e-excluded", 3 | "version": "0.1.0", 4 | "main": "index.js" 5 | } 6 | -------------------------------------------------------------------------------- /packages/playground/nested-deps/test-package-e/test-package-e-included/index.js: -------------------------------------------------------------------------------- 1 | import { testExcluded } from 'test-package-e-excluded' 2 | 3 | export function testIncluded() { 4 | return testExcluded() 5 | } 6 | -------------------------------------------------------------------------------- /packages/playground/nested-deps/test-package-e/test-package-e-included/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-package-e-included", 3 | "version": "0.1.0", 4 | "main": "index.js", 5 | "dependencies": { 6 | "test-package-e-excluded": "link:../test-package-e-excluded" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/playground/nested-deps/vite.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @type {import('vite').UserConfig} 3 | */ 4 | module.exports = { 5 | optimizeDeps: { 6 | include: [ 7 | 'test-package-a', 8 | 'test-package-b', 9 | 'test-package-c', 10 | 'test-package-c/side', 11 | 'test-package-d > test-package-d-nested', 12 | 'test-package-e-included' 13 | ], 14 | exclude: ['test-package-d', 'test-package-e-excluded'] 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/playground/optimize-deps/.hidden-dir/foo.js: -------------------------------------------------------------------------------- 1 | export const greeting = 'hello!' 2 | -------------------------------------------------------------------------------- /packages/playground/optimize-deps/dep-cjs-compiled-from-cjs/index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | function foo() { 3 | return 'foo' 4 | } 5 | module.exports = foo 6 | -------------------------------------------------------------------------------- /packages/playground/optimize-deps/dep-cjs-compiled-from-cjs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dep-cjs-compiled-from-cjs", 3 | "version": "0.0.0", 4 | "main": "index.js" 5 | } 6 | -------------------------------------------------------------------------------- /packages/playground/optimize-deps/dep-cjs-compiled-from-esm/index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | Object.defineProperty(exports, '__esModule', { value: true }) 3 | function foo() { 4 | return 'foo' 5 | } 6 | exports.default = foo 7 | -------------------------------------------------------------------------------- /packages/playground/optimize-deps/dep-cjs-compiled-from-esm/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dep-cjs-compiled-from-esm", 3 | "version": "0.0.0", 4 | "main": "index.js" 5 | } 6 | -------------------------------------------------------------------------------- /packages/playground/optimize-deps/dep-esbuild-plugin-transform/index.js: -------------------------------------------------------------------------------- 1 | // will be replaced by an esbuild plugin 2 | 3 | export const hello = () => `Hello from a package` 4 | -------------------------------------------------------------------------------- /packages/playground/optimize-deps/dep-esbuild-plugin-transform/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dep-esbuild-plugin-transform", 3 | "version": "0.0.0", 4 | "main": "index.js" 5 | } 6 | -------------------------------------------------------------------------------- /packages/playground/optimize-deps/dep-linked-include/Test.vue: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /packages/playground/optimize-deps/dep-linked-include/foo.js: -------------------------------------------------------------------------------- 1 | export const msg = '[success] linked force include' 2 | -------------------------------------------------------------------------------- /packages/playground/optimize-deps/dep-linked-include/index.mjs: -------------------------------------------------------------------------------- 1 | export { msg } from './foo.js' 2 | 3 | import { useState } from 'react' 4 | 5 | export function useCount() { 6 | return useState(0) 7 | } 8 | 9 | // test dep with css/asset imports 10 | import './test.css' 11 | 12 | // test importing node built-ins 13 | import fs from 'fs' 14 | 15 | if (false) { 16 | fs.readFileSync() 17 | } else { 18 | console.log('ok') 19 | } 20 | 21 | export { default as VueSFC } from './Test.vue' 22 | -------------------------------------------------------------------------------- /packages/playground/optimize-deps/dep-linked-include/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dep-linked-include", 3 | "version": "0.0.0", 4 | "main": "index.mjs", 5 | "dependencies": { 6 | "react": "17.0.2" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/playground/optimize-deps/dep-linked-include/test.css: -------------------------------------------------------------------------------- 1 | body { 2 | color: red; 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/optimize-deps/dep-linked/index.js: -------------------------------------------------------------------------------- 1 | export * from 'lodash-es' 2 | -------------------------------------------------------------------------------- /packages/playground/optimize-deps/dep-linked/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dep-linked", 3 | "version": "0.0.0", 4 | "main": "index.js", 5 | "dependencies": { 6 | "lodash-es": "^4.17.21" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/playground/optimize-deps/glob/foo.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios' 2 | 3 | axios.get('/ping').then((res) => { 4 | document.querySelector('.cjs-browser-field').textContent = res.data 5 | }) 6 | -------------------------------------------------------------------------------- /packages/playground/optimize-deps/nested-exclude/index.js: -------------------------------------------------------------------------------- 1 | export { default as nestedInclude } from 'nested-include' 2 | 3 | export default 'nested-exclude' 4 | -------------------------------------------------------------------------------- /packages/playground/optimize-deps/nested-exclude/nested-include/index.js: -------------------------------------------------------------------------------- 1 | // written in cjs, optimization should convert this to esm 2 | module.exports = 'nested-include' 3 | -------------------------------------------------------------------------------- /packages/playground/optimize-deps/nested-exclude/nested-include/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nested-include", 3 | "version": "1.0.0", 4 | "main": "index.js" 5 | } 6 | -------------------------------------------------------------------------------- /packages/playground/optimize-deps/nested-exclude/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nested-exclude", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "dependencies": { 6 | "nested-include": "link:./nested-include" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/playground/optimize-missing-deps/__test__/optimize-missing-deps.spec.ts: -------------------------------------------------------------------------------- 1 | import { port } from './serve' 2 | import fetch from 'node-fetch' 3 | import { untilUpdated } from '../../testUtils' 4 | 5 | const url = `http://localhost:${port}` 6 | 7 | test('*', async () => { 8 | await page.goto(url) 9 | // reload page to get optimized missing deps 10 | await page.reload() 11 | await untilUpdated(() => page.textContent('div'), 'Client') 12 | 13 | // raw http request 14 | const aboutHtml = await (await fetch(url)).text() 15 | expect(aboutHtml).toMatch('Server') 16 | }) 17 | -------------------------------------------------------------------------------- /packages/playground/optimize-missing-deps/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Vite App 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /packages/playground/optimize-missing-deps/main.js: -------------------------------------------------------------------------------- 1 | import { sayName } from 'missing-dep' 2 | 3 | export const name = sayName() 4 | -------------------------------------------------------------------------------- /packages/playground/optimize-missing-deps/missing-dep/index.js: -------------------------------------------------------------------------------- 1 | import { name } from 'multi-entry-dep' 2 | 3 | export function sayName() { 4 | return name 5 | } 6 | -------------------------------------------------------------------------------- /packages/playground/optimize-missing-deps/missing-dep/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "missing-dep", 3 | "version": "0.0.0", 4 | "main": "index.js", 5 | "dependencies": { 6 | "multi-entry-dep": "file:../multi-entry-dep" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/playground/optimize-missing-deps/multi-entry-dep/index.browser.js: -------------------------------------------------------------------------------- 1 | exports.name = 'Client' 2 | -------------------------------------------------------------------------------- /packages/playground/optimize-missing-deps/multi-entry-dep/index.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | 3 | exports.name = path.normalize('./Server') 4 | -------------------------------------------------------------------------------- /packages/playground/optimize-missing-deps/multi-entry-dep/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multi-entry-dep", 3 | "version": "0.0.0", 4 | "main": "index.js", 5 | "browser": { 6 | "./index.js": "./index.browser.js" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/playground/optimize-missing-deps/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "optimize-missing-deps", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "node server", 7 | "postinstall": "node ../../../scripts/patchFileDeps.cjs" 8 | }, 9 | "dependencies": { 10 | "missing-dep": "file:./missing-dep", 11 | "multi-entry-dep": "file:./multi-entry-dep" 12 | }, 13 | "devDependencies": { 14 | "express": "^4.17.1" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/playground/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vite-playground", 3 | "version": "1.0.0", 4 | "private": true, 5 | "devDependencies": { 6 | "css-color-names": "^1.0.1" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/playground/preload/index.html: -------------------------------------------------------------------------------- 1 |
2 | 9 | -------------------------------------------------------------------------------- /packages/playground/preload/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-preload", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "vite build", 8 | "debug": "node --inspect-brk ../../vite/bin/vite", 9 | "preview": "vite preview" 10 | }, 11 | "dependencies": { 12 | "vue": "^3.2.23", 13 | "vue-router": "^4.0.0" 14 | }, 15 | "devDependencies": { 16 | "@vitejs/plugin-vue": "workspace:*" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/playground/preload/src/App.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /packages/playground/preload/src/components/About.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /packages/playground/preload/src/components/Hello.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 13 | 14 | 19 | -------------------------------------------------------------------------------- /packages/playground/preload/src/components/Home.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /packages/playground/preload/vite.config.js: -------------------------------------------------------------------------------- 1 | const vuePlugin = require('@vitejs/plugin-vue') 2 | 3 | module.exports = { 4 | plugins: [vuePlugin()], 5 | build: { 6 | terserOptions: { 7 | format: { 8 | beautify: true 9 | }, 10 | compress: { 11 | passes: 3 12 | } 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/playground/preserve-symlinks/__tests__/preserve-symlinks.spec.ts: -------------------------------------------------------------------------------- 1 | test('should have no 404s', () => { 2 | browserLogs.forEach((msg) => { 3 | expect(msg).not.toMatch('404') 4 | }) 5 | }) 6 | 7 | test('not-preserve-symlinks', async () => { 8 | expect(await page.textContent('#root')).toBe('hello vite') 9 | }) 10 | -------------------------------------------------------------------------------- /packages/playground/preserve-symlinks/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Vite App 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /packages/playground/preserve-symlinks/moduleA/linked.js: -------------------------------------------------------------------------------- 1 | ./src/index.js -------------------------------------------------------------------------------- /packages/playground/preserve-symlinks/moduleA/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@symlinks/moduleA", 3 | "version": "0.0.0", 4 | "main": "linked.js" 5 | } 6 | -------------------------------------------------------------------------------- /packages/playground/preserve-symlinks/moduleA/src/data.js: -------------------------------------------------------------------------------- 1 | export const data = { 2 | msg: 'hello vite' 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/preserve-symlinks/moduleA/src/index.js: -------------------------------------------------------------------------------- 1 | import { data } from './data' 2 | 3 | export function sayHi() { 4 | return data 5 | } 6 | -------------------------------------------------------------------------------- /packages/playground/preserve-symlinks/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "preserve-symlinks", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "dev": "vite --force", 6 | "build": "vite build", 7 | "preview": "vite preview" 8 | }, 9 | "dependencies": { 10 | "@symlinks/moduleA": "link:./moduleA" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/playground/preserve-symlinks/src/main.js: -------------------------------------------------------------------------------- 1 | import { sayHi } from '@symlinks/moduleA' 2 | 3 | document.getElementById('root').innerText = sayHi().msg 4 | -------------------------------------------------------------------------------- /packages/playground/react-emotion/index.html: -------------------------------------------------------------------------------- 1 |
2 | 9 | -------------------------------------------------------------------------------- /packages/playground/react-emotion/vite.config.ts: -------------------------------------------------------------------------------- 1 | import react from '@vitejs/plugin-react' 2 | 3 | const config: import('vite').UserConfig = { 4 | plugins: [ 5 | react({ 6 | jsxImportSource: '@emotion/react', 7 | babel: { 8 | plugins: ['@emotion/babel-plugin'] 9 | } 10 | }) 11 | ], 12 | clearScreen: false, 13 | build: { 14 | // to make tests faster 15 | minify: false 16 | } 17 | } 18 | 19 | export default config 20 | -------------------------------------------------------------------------------- /packages/playground/react/components/Dummy.jsx: -------------------------------------------------------------------------------- 1 | export default function Dummy() { 2 | return <> 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/react/index.html: -------------------------------------------------------------------------------- 1 |
2 | 9 | -------------------------------------------------------------------------------- /packages/playground/react/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-react", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "vite build", 8 | "debug": "node --inspect-brk ../../vite/bin/vite", 9 | "preview": "vite preview" 10 | }, 11 | "dependencies": { 12 | "react": "^17.0.2", 13 | "react-dom": "^17.0.2" 14 | }, 15 | "devDependencies": { 16 | "@vitejs/plugin-react": "workspace:*" 17 | }, 18 | "babel": { 19 | "presets": [ 20 | "@babel/preset-env" 21 | ] 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/playground/react/vite.config.ts: -------------------------------------------------------------------------------- 1 | import react from '@vitejs/plugin-react' 2 | 3 | const config: import('vite').UserConfig = { 4 | plugins: [react()], 5 | build: { 6 | // to make tests faster 7 | minify: false 8 | } 9 | } 10 | 11 | export default config 12 | -------------------------------------------------------------------------------- /packages/playground/resolve-linked/dep.js: -------------------------------------------------------------------------------- 1 | export const msg = 'dep from upper directory' 2 | -------------------------------------------------------------------------------- /packages/playground/resolve-linked/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "resolve-linked", 3 | "version": "0.0.0", 4 | "private": true, 5 | "main": "src/index.js" 6 | } 7 | -------------------------------------------------------------------------------- /packages/playground/resolve-linked/src/index.js: -------------------------------------------------------------------------------- 1 | import { msg as depMsg } from '../dep' 2 | 3 | export const msg = `[success] out of root monorepo dep with ${depMsg}` 4 | -------------------------------------------------------------------------------- /packages/playground/resolve/browser-field/multiple.dot.path.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs') 2 | console.log('this should not run in the browser') 3 | -------------------------------------------------------------------------------- /packages/playground/resolve/browser-field/no-ext-index/index.js: -------------------------------------------------------------------------------- 1 | import jsdom from 'jsdom' // should be redireted to empty module 2 | export default '' 3 | -------------------------------------------------------------------------------- /packages/playground/resolve/browser-field/no-ext.js: -------------------------------------------------------------------------------- 1 | import jsdom from 'jsdom' // should be redireted to empty module 2 | export default '' 3 | -------------------------------------------------------------------------------- /packages/playground/resolve/browser-field/not-browser.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs') 2 | console.log('this should not run in the browser') 3 | -------------------------------------------------------------------------------- /packages/playground/resolve/browser-field/out/cjs.node.js: -------------------------------------------------------------------------------- 1 | export default 'fail' 2 | -------------------------------------------------------------------------------- /packages/playground/resolve/browser-field/out/esm.browser.js: -------------------------------------------------------------------------------- 1 | import jsdom from 'jsdom' // should be redireted to empty module 2 | export default '[success] resolve browser field' 3 | -------------------------------------------------------------------------------- /packages/playground/resolve/browser-field/relative.js: -------------------------------------------------------------------------------- 1 | import ra from './no-ext' 2 | import rb from './no-ext.js' // no substitution 3 | import rc from './ext' 4 | import rd from './ext.js' 5 | import re from './ext-index/index.js' 6 | import rf from './ext-index' 7 | import rg from './no-ext-index/index.js' // no substitution 8 | 9 | export { ra, rb, rc, rd, re, rf, rg } 10 | -------------------------------------------------------------------------------- /packages/playground/resolve/config-dep.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | a: 1 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/resolve/custom-condition/index.custom.js: -------------------------------------------------------------------------------- 1 | export const msg = '[success] custom condition' 2 | -------------------------------------------------------------------------------- /packages/playground/resolve/custom-condition/index.js: -------------------------------------------------------------------------------- 1 | export const msg = '[fail]' 2 | -------------------------------------------------------------------------------- /packages/playground/resolve/custom-condition/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "resolve-custom-condition", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "exports": { 6 | ".": { 7 | "custom": "./index.custom.js", 8 | "import": "./index.js", 9 | "require": "./index.js" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/playground/resolve/custom-ext.es: -------------------------------------------------------------------------------- 1 | export const msg = `[success] custom ext` 2 | -------------------------------------------------------------------------------- /packages/playground/resolve/custom-main-field/index.custom.js: -------------------------------------------------------------------------------- 1 | export const msg = '[success] custom main field' 2 | -------------------------------------------------------------------------------- /packages/playground/resolve/custom-main-field/index.js: -------------------------------------------------------------------------------- 1 | export const msg = '[fail]' 2 | -------------------------------------------------------------------------------- /packages/playground/resolve/custom-main-field/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "resolve-custom-main-field", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "custom": "index.custom.js" 6 | } 7 | -------------------------------------------------------------------------------- /packages/playground/resolve/dir-with-ext.js/empty: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/divriots/browser-vite/5721afb654901fd14b629f0b4d7eafe4587ea189/packages/playground/resolve/dir-with-ext.js/empty -------------------------------------------------------------------------------- /packages/playground/resolve/dir-with-ext/index.js: -------------------------------------------------------------------------------- 1 | export const file = '[success] ./dir-with-ext/index.js' 2 | -------------------------------------------------------------------------------- /packages/playground/resolve/dir.js: -------------------------------------------------------------------------------- 1 | export const file = '[success] dir.js' 2 | -------------------------------------------------------------------------------- /packages/playground/resolve/dir/index.js: -------------------------------------------------------------------------------- 1 | export const file = 'dir/index.js' 2 | -------------------------------------------------------------------------------- /packages/playground/resolve/exact-extension/file.js: -------------------------------------------------------------------------------- 1 | export const file = '[success] file.js' 2 | -------------------------------------------------------------------------------- /packages/playground/resolve/exact-extension/file.js.js: -------------------------------------------------------------------------------- 1 | export const file = 'file.js.js' 2 | -------------------------------------------------------------------------------- /packages/playground/resolve/exports-env/browser.js: -------------------------------------------------------------------------------- 1 | export const msg = 'fail (browser.js)' 2 | -------------------------------------------------------------------------------- /packages/playground/resolve/exports-env/browser.mjs: -------------------------------------------------------------------------------- 1 | export const msg = '[success] exports env (browser.mjs)' 2 | -------------------------------------------------------------------------------- /packages/playground/resolve/exports-env/browser.prod.mjs: -------------------------------------------------------------------------------- 1 | export const msg = '[success] exports env (browser.prod.mjs)' 2 | -------------------------------------------------------------------------------- /packages/playground/resolve/exports-env/fallback.umd.js: -------------------------------------------------------------------------------- 1 | export const msg = 'fail (fallback.umd.js)' 2 | -------------------------------------------------------------------------------- /packages/playground/resolve/exports-env/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "resolve-exports-env", 3 | "version": "1.0.0", 4 | "exports": { 5 | "import": { 6 | "browser": { 7 | "production": "./browser.prod.mjs", 8 | "development": "./browser.mjs" 9 | } 10 | }, 11 | "browser": "./browser.js", 12 | "default": "./fallback.umd.js" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/playground/resolve/exports-path/cjs.js: -------------------------------------------------------------------------------- 1 | exports.msg = 'from cjs' 2 | -------------------------------------------------------------------------------- /packages/playground/resolve/exports-path/deep.js: -------------------------------------------------------------------------------- 1 | export const msg = '[success] deep resolve from exports' 2 | -------------------------------------------------------------------------------- /packages/playground/resolve/exports-path/dir/dir.js: -------------------------------------------------------------------------------- 1 | export const msg = '[success] mapped directory from exports' 2 | -------------------------------------------------------------------------------- /packages/playground/resolve/exports-path/main.js: -------------------------------------------------------------------------------- 1 | export const msg = '[success] entry resolve from exports' 2 | -------------------------------------------------------------------------------- /packages/playground/resolve/exports-path/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "resolve-exports-path", 3 | "version": "1.0.0", 4 | "exports": { 5 | ".": { 6 | "import": "./main.js", 7 | "require": "./cjs.js" 8 | }, 9 | "./deep.js": "./deep.js", 10 | "./dir/": "./dir/", 11 | "./dir-mapped/*": { 12 | "import": "./dir/*", 13 | "require": "./dir-cjs/*" 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/playground/resolve/inline-package/inline.js: -------------------------------------------------------------------------------- 1 | export const msg = '[success] from inline package' 2 | -------------------------------------------------------------------------------- /packages/playground/resolve/inline-package/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "inline-package", 3 | "private": true, 4 | "sideEffects": false, 5 | "main": "./inline" 6 | } 7 | -------------------------------------------------------------------------------- /packages/playground/resolve/ts-extension/hello.ts: -------------------------------------------------------------------------------- 1 | export const msg = '[success] use .js extension to import a ts module' 2 | -------------------------------------------------------------------------------- /packages/playground/resolve/ts-extension/index.ts: -------------------------------------------------------------------------------- 1 | import { msg } from './hello.js' 2 | 3 | export { msg } 4 | -------------------------------------------------------------------------------- /packages/playground/resolve/utf8-bom/main.js: -------------------------------------------------------------------------------- 1 | import '@babel/runtime/helpers/esm/slicedToArray' 2 | 3 | export const msg = '[success]' 4 | -------------------------------------------------------------------------------- /packages/playground/resolve/util/bar.util.js: -------------------------------------------------------------------------------- 1 | export function bar() { 2 | return '[success] resolve filename containing dot and omitting ext' 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/resolve/util/index.js: -------------------------------------------------------------------------------- 1 | export function foo() { 2 | return '[success] resolve omitted /index.*' 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/shims.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'css-color-names' { 2 | const colors: Record 3 | export default colors 4 | } 5 | 6 | declare module '*.vue' { 7 | import { ComponentOptions } from 'vue' 8 | const component: ComponentOptions 9 | export default component 10 | } 11 | -------------------------------------------------------------------------------- /packages/playground/ssr-deps/forwarded-export/index.js: -------------------------------------------------------------------------------- 1 | const original = require('object-assigned-exports') 2 | module.exports = original 3 | -------------------------------------------------------------------------------- /packages/playground/ssr-deps/forwarded-export/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "forwarded-export", 3 | "version": "0.0.0", 4 | "private": true 5 | } 6 | -------------------------------------------------------------------------------- /packages/playground/ssr-deps/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | SSR Dependencies 7 | 8 | 9 |

SSR Dependencies

10 |
11 | 12 | 13 | -------------------------------------------------------------------------------- /packages/playground/ssr-deps/message: -------------------------------------------------------------------------------- 1 | File Content! 2 | -------------------------------------------------------------------------------- /packages/playground/ssr-deps/node-addon/README.md: -------------------------------------------------------------------------------- 1 | This test aim to correctly resolve the `.node` file when loading CJS and ESM using dynamic import 2 | 3 | Steps to build `.node` file, refer to [here](https://nodejs.org/api/addons.html#building) 4 | -------------------------------------------------------------------------------- /packages/playground/ssr-deps/node-addon/binding.gyp: -------------------------------------------------------------------------------- 1 | { 2 | "targets": [ 3 | { 4 | "target_name": "cpp_addon", 5 | "sources": [ 6 | "main.cpp" 7 | ] 8 | } 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /packages/playground/ssr-deps/node-addon/index.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | const cpp = require(path.resolve(__dirname, './build/Release/cpp_addon.node')) 3 | exports.hello = cpp.hello 4 | -------------------------------------------------------------------------------- /packages/playground/ssr-deps/node-addon/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace v8; 4 | 5 | void HelloWorld(const FunctionCallbackInfo& args) { 6 | Isolate* isolate = args.GetIsolate(); 7 | Local hello = String::NewFromUtf8(isolate, "Hello World!", NewStringType::kNormal).ToLocalChecked(); 8 | args.GetReturnValue().Set(hello); 9 | } 10 | 11 | void Init(Local exports) { 12 | NODE_SET_METHOD(exports, "hello", HelloWorld); 13 | } 14 | 15 | NODE_MODULE(cpp_addon, Init) 16 | -------------------------------------------------------------------------------- /packages/playground/ssr-deps/node-addon/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "node-addon", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": { 6 | "install": "node-gyp install && node-gyp rebuild" 7 | }, 8 | "dependencies": { 9 | "node-gyp": "^8.4.1" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/playground/ssr-deps/object-assigned-exports/index.js: -------------------------------------------------------------------------------- 1 | Object.defineProperty(exports, '__esModule', { value: true }) 2 | 3 | const obj = { 4 | hello() { 5 | return 'Hello World!' 6 | } 7 | } 8 | 9 | Object.assign(exports, obj) 10 | -------------------------------------------------------------------------------- /packages/playground/ssr-deps/object-assigned-exports/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "object-assigned-exports", 3 | "version": "0.0.0", 4 | "private": true 5 | } 6 | -------------------------------------------------------------------------------- /packages/playground/ssr-deps/primitive-export/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 'Hello World!' 2 | -------------------------------------------------------------------------------- /packages/playground/ssr-deps/primitive-export/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "primitive-export", 3 | "version": "0.0.0", 4 | "private": true 5 | } 6 | -------------------------------------------------------------------------------- /packages/playground/ssr-deps/read-file-content/index.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | 3 | module.exports = async function readFileContent(filePath) { 4 | const fs = 5 | process.versions.node.split('.')[0] >= '14' 6 | ? require('fs/promises') 7 | : require('fs').promises 8 | return await fs.readFile(path.resolve(filePath), 'utf-8') 9 | } 10 | -------------------------------------------------------------------------------- /packages/playground/ssr-deps/read-file-content/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "read-file-content", 3 | "version": "0.0.0", 4 | "private": true 5 | } 6 | -------------------------------------------------------------------------------- /packages/playground/ssr-deps/ts-transpiled-exports/index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | Object.defineProperty(exports, '__esModule', { value: true }) 3 | exports.hello = void 0 4 | function hello() { 5 | return 'Hello World!' 6 | } 7 | exports.hello = hello 8 | exports.default = hello 9 | -------------------------------------------------------------------------------- /packages/playground/ssr-deps/ts-transpiled-exports/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ts-transpiled-exports", 3 | "version": "0.0.0", 4 | "private": true 5 | } 6 | -------------------------------------------------------------------------------- /packages/playground/ssr-deps/vite.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @type {import('vite').UserConfig} 3 | */ 4 | module.exports = { 5 | resolve: { 6 | // The dependency `node-addon` needs to be linked to node_modules and preserve symlinks, 7 | // because the `.node` file cannot be unlinked in Windows after being filed to node_modules 8 | // ref: https://github.com/nodejs/node/issues/24878/ 9 | preserveSymlinks: true 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/playground/ssr-html/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | SSR HTML 7 | 8 | 9 |

SSR Dynamic HTML

10 | 11 | 12 | -------------------------------------------------------------------------------- /packages/playground/ssr-html/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-ssr-html", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "node server", 7 | "serve": "cross-env NODE_ENV=production node server", 8 | "debug": "node --inspect-brk server" 9 | }, 10 | "dependencies": {}, 11 | "devDependencies": { 12 | "cross-env": "^7.0.3", 13 | "express": "^4.17.1" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/playground/ssr-html/src/app.js: -------------------------------------------------------------------------------- 1 | const p = document.createElement('p') 2 | p.innerHTML = '✅ Dynamically injected script from file' 3 | document.body.appendChild(p) 4 | -------------------------------------------------------------------------------- /packages/playground/ssr-pug/index.pug: -------------------------------------------------------------------------------- 1 | doctype html 2 | html 3 | head 4 | meta(charset='UTF-8') 5 | meta(name='viewport' content='width=device-width, initial-scale=1.0') 6 | title SSR Pug 7 | body 8 | h1 SSR Pug 9 | -------------------------------------------------------------------------------- /packages/playground/ssr-pug/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-ssr-pug", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "node server", 7 | "serve": "cross-env NODE_ENV=production node server", 8 | "debug": "node --inspect-brk server" 9 | }, 10 | "devDependencies": { 11 | "cross-env": "^7.0.3", 12 | "express": "^4.17.1", 13 | "pug": "^3.0.2" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/playground/ssr-pug/src/app.js: -------------------------------------------------------------------------------- 1 | const p = document.createElement('p') 2 | p.innerHTML = '✅ Dynamically injected script from file' 3 | document.body.appendChild(p) 4 | -------------------------------------------------------------------------------- /packages/playground/ssr-react/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Vite App 7 | 8 | 9 |
10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /packages/playground/ssr-react/src/add.js: -------------------------------------------------------------------------------- 1 | import { multiply } from './multiply' 2 | 3 | export function add(a, b) { 4 | return a + b 5 | } 6 | 7 | export function addAndMultiply(a, b, c) { 8 | return multiply(add(a, b), c) 9 | } 10 | -------------------------------------------------------------------------------- /packages/playground/ssr-react/src/circular-dep-init/README.md: -------------------------------------------------------------------------------- 1 | This test aim to find out wherever the modules with circular dependencies are correctly initialized 2 | -------------------------------------------------------------------------------- /packages/playground/ssr-react/src/circular-dep-init/circular-dep-init.js: -------------------------------------------------------------------------------- 1 | export * from './module-a' 2 | export { getValueAB } from './module-b' 3 | -------------------------------------------------------------------------------- /packages/playground/ssr-react/src/circular-dep-init/module-a.js: -------------------------------------------------------------------------------- 1 | export const valueA = 'circ-dep-init-a' 2 | -------------------------------------------------------------------------------- /packages/playground/ssr-react/src/circular-dep-init/module-b.js: -------------------------------------------------------------------------------- 1 | import { valueA } from './circular-dep-init' 2 | 3 | export const valueB = 'circ-dep-init-b' 4 | export const valueAB = valueA.concat(` ${valueB}`) 5 | 6 | export function getValueAB() { 7 | return valueAB 8 | } 9 | -------------------------------------------------------------------------------- /packages/playground/ssr-react/src/entry-client.jsx: -------------------------------------------------------------------------------- 1 | import ReactDOM from 'react-dom' 2 | import { BrowserRouter } from 'react-router-dom' 3 | import { App } from './App' 4 | 5 | ReactDOM.hydrate( 6 | 7 | 8 | , 9 | document.getElementById('app') 10 | ) 11 | -------------------------------------------------------------------------------- /packages/playground/ssr-react/src/entry-server.jsx: -------------------------------------------------------------------------------- 1 | import ReactDOMServer from 'react-dom/server' 2 | import { StaticRouter } from 'react-router-dom' 3 | import { App } from './App' 4 | 5 | export function render(url, context) { 6 | return ReactDOMServer.renderToString( 7 | 8 | 9 | 10 | ) 11 | } 12 | -------------------------------------------------------------------------------- /packages/playground/ssr-react/src/forked-deadlock/common-module.js: -------------------------------------------------------------------------------- 1 | import { stuckModuleExport } from './stuck-module' 2 | import { deadlockfuseModuleExport } from './deadlock-fuse-module' 3 | 4 | /** 5 | * module H 6 | */ 7 | export function commonModuleExport() { 8 | stuckModuleExport() 9 | deadlockfuseModuleExport() 10 | } 11 | -------------------------------------------------------------------------------- /packages/playground/ssr-react/src/forked-deadlock/deadlock-fuse-module.js: -------------------------------------------------------------------------------- 1 | import { fuseStuckBridgeModuleExport } from './fuse-stuck-bridge-module' 2 | 3 | /** 4 | * module A 5 | */ 6 | export function deadlockfuseModuleExport() { 7 | fuseStuckBridgeModuleExport() 8 | } 9 | -------------------------------------------------------------------------------- /packages/playground/ssr-react/src/forked-deadlock/fuse-stuck-bridge-module.js: -------------------------------------------------------------------------------- 1 | import { stuckModuleExport } from './stuck-module' 2 | 3 | /** 4 | * module C 5 | */ 6 | export function fuseStuckBridgeModuleExport() { 7 | stuckModuleExport() 8 | } 9 | -------------------------------------------------------------------------------- /packages/playground/ssr-react/src/forked-deadlock/middle-module.js: -------------------------------------------------------------------------------- 1 | import { deadlockfuseModuleExport } from './deadlock-fuse-module' 2 | 3 | /** 4 | * module Y 5 | */ 6 | export function middleModuleExport() { 7 | void deadlockfuseModuleExport 8 | } 9 | -------------------------------------------------------------------------------- /packages/playground/ssr-react/src/forked-deadlock/stuck-module.js: -------------------------------------------------------------------------------- 1 | import { middleModuleExport } from './middle-module' 2 | 3 | /** 4 | * module X 5 | */ 6 | export function stuckModuleExport() { 7 | middleModuleExport() 8 | } 9 | -------------------------------------------------------------------------------- /packages/playground/ssr-react/src/multiply.js: -------------------------------------------------------------------------------- 1 | import { add } from './add' 2 | 3 | export function multiply(a, b) { 4 | return a * b 5 | } 6 | 7 | export function multiplyAndAdd(a, b, c) { 8 | return add(multiply(a, b), c) 9 | } 10 | -------------------------------------------------------------------------------- /packages/playground/ssr-react/src/pages/About.jsx: -------------------------------------------------------------------------------- 1 | import { addAndMultiply } from '../add' 2 | import { multiplyAndAdd } from '../multiply' 3 | 4 | export default function About() { 5 | return ( 6 | <> 7 |

About

8 |
{addAndMultiply(1, 2, 3)}
9 |
{multiplyAndAdd(1, 2, 3)}
10 | 11 | ) 12 | } 13 | -------------------------------------------------------------------------------- /packages/playground/ssr-react/src/pages/Env.jsx: -------------------------------------------------------------------------------- 1 | export default function Env() { 2 | let msg = 'default message here' 3 | try { 4 | msg = process.env.MY_CUSTOM_SECRET || msg 5 | } catch {} 6 | return

{msg}

7 | } 8 | -------------------------------------------------------------------------------- /packages/playground/ssr-react/src/pages/Home.jsx: -------------------------------------------------------------------------------- 1 | import { addAndMultiply } from '../add' 2 | import { multiplyAndAdd } from '../multiply' 3 | import { commonModuleExport } from '../forked-deadlock/common-module' 4 | import { getValueAB } from '../circular-dep-init/circular-dep-init' 5 | 6 | export default function Home() { 7 | commonModuleExport() 8 | 9 | return ( 10 | <> 11 |

Home

12 |
{addAndMultiply(1, 2, 3)}
13 |
{multiplyAndAdd(1, 2, 3)}
14 |
{getValueAB()}
15 | 16 | ) 17 | } 18 | -------------------------------------------------------------------------------- /packages/playground/ssr-react/vite.config.js: -------------------------------------------------------------------------------- 1 | const react = require('@vitejs/plugin-react') 2 | 3 | /** 4 | * @type {import('vite').UserConfig} 5 | */ 6 | module.exports = { 7 | plugins: [react()], 8 | build: { 9 | minify: false 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/playground/ssr-vue/dep-import-type/deep/index.d.ts: -------------------------------------------------------------------------------- 1 | export interface Foo {} 2 | -------------------------------------------------------------------------------- /packages/playground/ssr-vue/dep-import-type/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dep-import-type", 3 | "version": "0.0.0", 4 | "main": "index.js" 5 | } 6 | -------------------------------------------------------------------------------- /packages/playground/ssr-vue/example-external-component/ExampleExternalComponent.vue: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /packages/playground/ssr-vue/example-external-component/index.js: -------------------------------------------------------------------------------- 1 | import ExampleExternalComponent from './ExampleExternalComponent.vue' 2 | 3 | export default ExampleExternalComponent 4 | -------------------------------------------------------------------------------- /packages/playground/ssr-vue/example-external-component/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example-external-component", 3 | "private": true, 4 | "version": "0.0.0", 5 | "main": "index.js" 6 | } 7 | -------------------------------------------------------------------------------- /packages/playground/ssr-vue/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Vite App 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /packages/playground/ssr-vue/src/assets/fonts/Inter-Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/divriots/browser-vite/5721afb654901fd14b629f0b4d7eafe4587ea189/packages/playground/ssr-vue/src/assets/fonts/Inter-Italic.woff -------------------------------------------------------------------------------- /packages/playground/ssr-vue/src/assets/fonts/Inter-Italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/divriots/browser-vite/5721afb654901fd14b629f0b4d7eafe4587ea189/packages/playground/ssr-vue/src/assets/fonts/Inter-Italic.woff2 -------------------------------------------------------------------------------- /packages/playground/ssr-vue/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/divriots/browser-vite/5721afb654901fd14b629f0b4d7eafe4587ea189/packages/playground/ssr-vue/src/assets/logo.png -------------------------------------------------------------------------------- /packages/playground/ssr-vue/src/components/Foo.jsx: -------------------------------------------------------------------------------- 1 | import { defineComponent } from 'vue' 2 | import './foo.css' 3 | 4 | // named exports w/ variable declaration: ok 5 | export const Foo = defineComponent({ 6 | name: 'foo', 7 | setup() { 8 | return () =>
from JSX
9 | } 10 | }) 11 | -------------------------------------------------------------------------------- /packages/playground/ssr-vue/src/components/ImportType.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 9 | -------------------------------------------------------------------------------- /packages/playground/ssr-vue/src/components/foo.css: -------------------------------------------------------------------------------- 1 | .jsx { 2 | color: blue; 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/ssr-vue/src/entry-client.js: -------------------------------------------------------------------------------- 1 | import { createApp } from './main' 2 | 3 | const { app, router } = createApp() 4 | 5 | // wait until router is ready before mounting to ensure hydration match 6 | router.isReady().then(() => { 7 | app.mount('#app') 8 | }) 9 | -------------------------------------------------------------------------------- /packages/playground/ssr-vue/src/main.js: -------------------------------------------------------------------------------- 1 | import App from './App.vue' 2 | import { createSSRApp } from 'vue' 3 | import { createRouter } from './router' 4 | 5 | // SSR requires a fresh app instance per request, therefore we export a function 6 | // that creates a fresh app instance. If using Vuex, we'd also be creating a 7 | // fresh store here. 8 | export function createApp() { 9 | const app = createSSRApp(App) 10 | const router = createRouter() 11 | app.use(router) 12 | return { app, router } 13 | } 14 | -------------------------------------------------------------------------------- /packages/playground/ssr-vue/src/pages/About.vue: -------------------------------------------------------------------------------- 1 | 5 | 6 | 19 | 20 | 25 | -------------------------------------------------------------------------------- /packages/playground/ssr-vue/src/pages/External.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 14 | -------------------------------------------------------------------------------- /packages/playground/ssr-vue/src/pages/Store.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 19 | 20 | 25 | -------------------------------------------------------------------------------- /packages/playground/ssr-webworker/__tests__/ssr-webworker.spec.ts: -------------------------------------------------------------------------------- 1 | import { port } from './serve' 2 | 3 | const url = `http://localhost:${port}` 4 | 5 | test('/', async () => { 6 | await page.goto(url + '/') 7 | expect(await page.textContent('h1')).toMatch('hello from webworker') 8 | expect(await page.textContent('.linked')).toMatch('dep from upper directory') 9 | expect(await page.textContent('.external')).toMatch('object') 10 | }) 11 | -------------------------------------------------------------------------------- /packages/playground/ssr-webworker/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-ssr-webworker", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "DEV=1 node worker", 7 | "build:worker": "vite build --ssr src/entry-worker.jsx --outDir dist/worker" 8 | }, 9 | "dependencies": { 10 | "react": "^17.0.2" 11 | }, 12 | "devDependencies": { 13 | "miniflare": "^1.4.1", 14 | "resolve-linked": "workspace:*" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/playground/ssr-webworker/src/entry-worker.jsx: -------------------------------------------------------------------------------- 1 | import { msg as linkedMsg } from 'resolve-linked' 2 | import React from 'react' 3 | 4 | addEventListener('fetch', function (event) { 5 | return event.respondWith( 6 | new Response( 7 | ` 8 |

hello from webworker

9 |

${linkedMsg}

10 |

${typeof React}

11 | `, 12 | { 13 | headers: { 14 | 'content-type': 'text/html' 15 | } 16 | } 17 | ) 18 | ) 19 | }) 20 | -------------------------------------------------------------------------------- /packages/playground/ssr-webworker/vite.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @type {import('vite').UserConfig} 3 | */ 4 | module.exports = { 5 | build: { 6 | minify: false 7 | }, 8 | resolve: { 9 | dedupe: ['react'] 10 | }, 11 | ssr: { 12 | target: 'webworker', 13 | noExternal: true 14 | }, 15 | plugins: [ 16 | { 17 | config() { 18 | return { 19 | ssr: { 20 | noExternal: ['this-should-not-replace-the-boolean'] 21 | } 22 | } 23 | } 24 | } 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /packages/playground/tailwind/index.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | -------------------------------------------------------------------------------- /packages/playground/tailwind/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Vite App 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /packages/playground/tailwind/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-tailwind", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "vite build", 8 | "debug": "node --inspect-brk ../../vite/bin/vite", 9 | "preview": "vite preview" 10 | }, 11 | "dependencies": { 12 | "autoprefixer": "^10.4.0", 13 | "tailwindcss": "^2.2.19", 14 | "vue": "^3.2.23", 15 | "vue-router": "^4.0.0" 16 | }, 17 | "devDependencies": { 18 | "@vitejs/plugin-vue": "workspace:*" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/playground/tailwind/postcss.config.js: -------------------------------------------------------------------------------- 1 | // postcss.config.js 2 | module.exports = { 3 | plugins: { 4 | tailwindcss: { config: __dirname + '/tailwind.config.js' }, 5 | autoprefixer: {} 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/playground/tailwind/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/divriots/browser-vite/5721afb654901fd14b629f0b4d7eafe4587ea189/packages/playground/tailwind/public/favicon.ico -------------------------------------------------------------------------------- /packages/playground/tailwind/src/App.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 13 | -------------------------------------------------------------------------------- /packages/playground/tailwind/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/divriots/browser-vite/5721afb654901fd14b629f0b4d7eafe4587ea189/packages/playground/tailwind/src/assets/logo.png -------------------------------------------------------------------------------- /packages/playground/tailwind/src/components/HelloWorld.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 10 | -------------------------------------------------------------------------------- /packages/playground/tailwind/src/main.js: -------------------------------------------------------------------------------- 1 | import { createApp } from 'vue' 2 | import App from './App.vue' 3 | import router from './router' 4 | // import '../index.css'; 5 | 6 | createApp(App).use(router).mount('#app') 7 | -------------------------------------------------------------------------------- /packages/playground/tailwind/src/router.ts: -------------------------------------------------------------------------------- 1 | import { createWebHistory, createRouter } from 'vue-router' 2 | import Page from './views/Page.vue' 3 | 4 | const history = createWebHistory() 5 | 6 | const routeur = createRouter({ 7 | history: history, 8 | routes: [ 9 | { 10 | path: '/', 11 | component: Page 12 | } 13 | ] 14 | }) 15 | 16 | export default routeur 17 | -------------------------------------------------------------------------------- /packages/playground/tailwind/tailwind.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | mode: 'jit', 3 | purge: [__dirname + '/src/**/*.vue'], 4 | darkMode: false, // or 'media' or 'class' 5 | theme: { 6 | extend: {} 7 | }, 8 | variants: { 9 | extend: {} 10 | }, 11 | plugins: [] 12 | } 13 | -------------------------------------------------------------------------------- /packages/playground/tailwind/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite' 2 | import vue from '@vitejs/plugin-vue' 3 | 4 | export default defineConfig({ 5 | resolve: { 6 | alias: { 7 | '/@': __dirname 8 | } 9 | }, 10 | plugins: [vue()], 11 | build: { 12 | // to make tests faster 13 | minify: false 14 | }, 15 | server: { 16 | // This option caused issues with HMR, 17 | // although it should not affect the build 18 | origin: 'http://localhost:8080/' 19 | } 20 | }) 21 | -------------------------------------------------------------------------------- /packages/playground/tsconfig-json-load-error/has-error/main.ts: -------------------------------------------------------------------------------- 1 | console.log('tsconfig error fixed, file loaded') 2 | -------------------------------------------------------------------------------- /packages/playground/tsconfig-json-load-error/has-error/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | // this config is deliberately malformed to test how vite handles broken tsconfig 3 | "compilerOptions": 4 | } -------------------------------------------------------------------------------- /packages/playground/tsconfig-json-load-error/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Vite App 7 | 8 | 9 |
10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /packages/playground/tsconfig-json-load-error/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tsconfig-json-load-error", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "vite build", 8 | "debug": "node --inspect-brk ../../vite/bin/vite", 9 | "preview": "vite preview" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/playground/tsconfig-json-load-error/src/main.ts: -------------------------------------------------------------------------------- 1 | // @ts-nocheck 2 | import '../has-error/main' 3 | -------------------------------------------------------------------------------- /packages/playground/tsconfig-json-load-error/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "module": "ESNext", 5 | "lib": ["ESNext", "DOM"], 6 | "moduleResolution": "Node", 7 | "strict": true, 8 | "sourceMap": true, 9 | "resolveJsonModule": true, 10 | "esModuleInterop": true, 11 | "noEmit": true, 12 | "noUnusedLocals": true, 13 | "noUnusedParameters": true, 14 | "noImplicitReturns": true, 15 | 16 | "useDefineForClassFields": true, 17 | "importsNotUsedAsValues": "preserve" 18 | }, 19 | "include": ["./src"] 20 | } 21 | -------------------------------------------------------------------------------- /packages/playground/tsconfig-json/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Vite App 7 | 8 | 9 |
10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /packages/playground/tsconfig-json/nested-with-extends/main.ts: -------------------------------------------------------------------------------- 1 | // @ts-nocheck 2 | import { NestedWithExtendsTypeOnlyClass } from './not-used-type' 3 | 4 | class NestedWithExtendsBase { 5 | set data(value: string) { 6 | console.log('data setter in NestedWithExtendsBase') 7 | } 8 | } 9 | class NestedWithExtendsDerived extends NestedWithExtendsBase { 10 | // No longer triggers a 'console.log' 11 | // when using 'useDefineForClassFields'. 12 | data = 10 13 | 14 | foo?: NestedWithExtendsTypeOnlyClass 15 | } 16 | 17 | const d = new NestedWithExtendsDerived() 18 | -------------------------------------------------------------------------------- /packages/playground/tsconfig-json/nested-with-extends/not-used-type.ts: -------------------------------------------------------------------------------- 1 | console.log('nested-with-extends side effect') 2 | 3 | export class NestedWithExtendsTypeOnlyClass {} 4 | -------------------------------------------------------------------------------- /packages/playground/tsconfig-json/nested-with-extends/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "include": ["./"], 4 | "compilerOptions": { 5 | "useDefineForClassFields": false 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/playground/tsconfig-json/nested/main.ts: -------------------------------------------------------------------------------- 1 | // @ts-nocheck 2 | import { NestedTypeOnlyClass } from './not-used-type' 3 | 4 | class NestedBase { 5 | set data(value: string) { 6 | console.log('data setter in NestedBase') 7 | } 8 | } 9 | class NestedDerived extends NestedBase { 10 | // No longer triggers a 'console.log' 11 | // when using 'useDefineForClassFields'. 12 | data = 10 13 | 14 | foo?: NestedTypeOnlyClass 15 | } 16 | 17 | const d = new NestedDerived() 18 | -------------------------------------------------------------------------------- /packages/playground/tsconfig-json/nested/not-used-type.ts: -------------------------------------------------------------------------------- 1 | console.log('nested side effect') 2 | 3 | export class NestedTypeOnlyClass {} 4 | -------------------------------------------------------------------------------- /packages/playground/tsconfig-json/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tsconfig-json", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "vite build", 8 | "debug": "node --inspect-brk ../../vite/bin/vite", 9 | "preview": "vite preview" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/playground/tsconfig-json/src/main.ts: -------------------------------------------------------------------------------- 1 | // @ts-nocheck 2 | import '../nested/main' 3 | import '../nested-with-extends/main' 4 | 5 | import { MainTypeOnlyClass } from './not-used-type' 6 | 7 | class MainBase { 8 | set data(value: string) { 9 | console.log('data setter in MainBase') 10 | } 11 | } 12 | class MainDerived extends MainBase { 13 | // No longer triggers a 'console.log' 14 | // when using 'useDefineForClassFields'. 15 | data = 10 16 | 17 | foo?: MainTypeOnlyClass 18 | } 19 | 20 | const d = new MainDerived() 21 | -------------------------------------------------------------------------------- /packages/playground/tsconfig-json/src/not-used-type.ts: -------------------------------------------------------------------------------- 1 | console.log('main side effect') 2 | 3 | export class MainTypeOnlyClass {} 4 | -------------------------------------------------------------------------------- /packages/playground/tsconfig-json/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "module": "ESNext", 5 | "lib": ["ESNext", "DOM"], 6 | "moduleResolution": "Node", 7 | "strict": true, 8 | "sourceMap": true, 9 | "resolveJsonModule": true, 10 | "esModuleInterop": true, 11 | "noEmit": true, 12 | "noUnusedLocals": true, 13 | "noUnusedParameters": true, 14 | "noImplicitReturns": true, 15 | 16 | "useDefineForClassFields": true, 17 | "importsNotUsedAsValues": "preserve" 18 | }, 19 | "include": ["./src"] 20 | } 21 | -------------------------------------------------------------------------------- /packages/playground/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": ["."], 3 | "exclude": ["**/dist/**"], 4 | "compilerOptions": { 5 | "target": "es2019", 6 | "outDir": "dist", 7 | "allowJs": true, 8 | "esModuleInterop": true, 9 | "moduleResolution": "node", 10 | "baseUrl": ".", 11 | "jsx": "preserve", 12 | "types": ["vite/client", "jest", "node"] 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/playground/vue-jsx/Comp.tsx: -------------------------------------------------------------------------------- 1 | import { defineComponent, ref } from 'vue' 2 | 3 | const Default = defineComponent(() => { 4 | const count = ref(3) 5 | const inc = () => count.value++ 6 | 7 | return () => ( 8 | 11 | ) 12 | }) 13 | 14 | export default Default 15 | -------------------------------------------------------------------------------- /packages/playground/vue-jsx/OtherExt.tesx: -------------------------------------------------------------------------------- 1 | import { defineComponent } from 'vue' 2 | 3 | const Default = defineComponent(() => { 4 | return () => ( 5 |

Other Ext

6 | ) 7 | }) 8 | 9 | export default Default 10 | -------------------------------------------------------------------------------- /packages/playground/vue-jsx/Script.vue: -------------------------------------------------------------------------------- 1 | 15 | -------------------------------------------------------------------------------- /packages/playground/vue-jsx/SrcImport.jsx: -------------------------------------------------------------------------------- 1 | import { defineComponent, ref } from 'vue' 2 | 3 | export default defineComponent(() => { 4 | const count = ref(5) 5 | const inc = () => count.value++ 6 | 7 | return () => ( 8 | 11 | ) 12 | }) 13 | -------------------------------------------------------------------------------- /packages/playground/vue-jsx/SrcImport.vue: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /packages/playground/vue-jsx/index.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | -------------------------------------------------------------------------------- /packages/playground/vue-jsx/main.jsx: -------------------------------------------------------------------------------- 1 | import { createApp } from 'vue' 2 | import { Named, NamedSpec, default as Default } from './Comps' 3 | import { default as TsxDefault } from './Comp' 4 | import OtherExt from './OtherExt.tesx' 5 | import JsxScript from './Script.vue' 6 | import JsxSrcImport from './SrcImport.vue' 7 | 8 | function App() { 9 | return ( 10 | <> 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | ) 20 | } 21 | 22 | createApp(App).mount('#app') 23 | -------------------------------------------------------------------------------- /packages/playground/vue-jsx/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-vue-jsx", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "vite build", 8 | "debug": "node --inspect-brk ../../vite/bin/vite", 9 | "preview": "vite preview" 10 | }, 11 | "dependencies": { 12 | "vue": "^3.2.23" 13 | }, 14 | "devDependencies": { 15 | "@vitejs/plugin-vue": "workspace:*", 16 | "@vitejs/plugin-vue-jsx": "workspace:*" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/playground/vue-jsx/vite.config.js: -------------------------------------------------------------------------------- 1 | const vueJsxPlugin = require('@vitejs/plugin-vue-jsx') 2 | const vuePlugin = require('@vitejs/plugin-vue') 3 | 4 | /** 5 | * @type {import('vite').UserConfig} 6 | */ 7 | module.exports = { 8 | plugins: [ 9 | vueJsxPlugin({ 10 | include: [/\.tesx$/, /\.[jt]sx$/] 11 | }), 12 | vuePlugin() 13 | ], 14 | build: { 15 | // to make tests faster 16 | minify: false 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/playground/vue/AsyncComponent.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 16 | -------------------------------------------------------------------------------- /packages/playground/vue/CssModules.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 18 | 19 | 24 | -------------------------------------------------------------------------------- /packages/playground/vue/CustomBlockPlugin.ts: -------------------------------------------------------------------------------- 1 | import { Plugin } from 'vite' 2 | 3 | export const vueI18nPlugin: Plugin = { 4 | name: 'vue-i18n', 5 | transform(code, id) { 6 | if (!/vue&type=i18n/.test(id)) { 7 | return 8 | } 9 | if (/\.ya?ml$/.test(id)) { 10 | code = JSON.stringify(require('js-yaml').load(code.trim())) 11 | } 12 | return { 13 | code: `export default Comp => { 14 | Comp.i18n = ${code} 15 | }`, 16 | map: { mappings: '' } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/playground/vue/CustomElement.ce.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 21 | 22 | 27 | -------------------------------------------------------------------------------- /packages/playground/vue/Hmr.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 15 | 16 | 21 | -------------------------------------------------------------------------------- /packages/playground/vue/Node.vue: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /packages/playground/vue/RefTransform.vue: -------------------------------------------------------------------------------- 1 | 5 | 6 | 10 | -------------------------------------------------------------------------------- /packages/playground/vue/ScanDep.vue: -------------------------------------------------------------------------------- 1 | 5 | 6 | 9 | -------------------------------------------------------------------------------- /packages/playground/vue/Slotted.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 13 | -------------------------------------------------------------------------------- /packages/playground/vue/Syntax.vue: -------------------------------------------------------------------------------- 1 | 5 | 6 | 15 | -------------------------------------------------------------------------------- /packages/playground/vue/assets/asset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/divriots/browser-vite/5721afb654901fd14b629f0b4d7eafe4587ea189/packages/playground/vue/assets/asset.png -------------------------------------------------------------------------------- /packages/playground/vue/index.html: -------------------------------------------------------------------------------- 1 |
2 | 10 | 11 | -------------------------------------------------------------------------------- /packages/playground/vue/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-vue", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "vite build", 8 | "debug": "node --inspect-brk ../../vite/bin/vite", 9 | "preview": "vite preview" 10 | }, 11 | "dependencies": { 12 | "lodash-es": "^4.17.21", 13 | "vue": "^3.2.23" 14 | }, 15 | "devDependencies": { 16 | "@vitejs/plugin-vue": "workspace:*", 17 | "js-yaml": "^4.1.0", 18 | "less": "^4.1.2", 19 | "pug": "^3.0.2", 20 | "sass": "^1.43.4", 21 | "stylus": "^0.55.0" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/playground/vue/public/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/divriots/browser-vite/5721afb654901fd14b629f0b4d7eafe4587ea189/packages/playground/vue/public/icon.png -------------------------------------------------------------------------------- /packages/playground/vue/setup-import-template/SetupImportTemplate.vue: -------------------------------------------------------------------------------- 1 | 2 | 6 | -------------------------------------------------------------------------------- /packages/playground/vue/setup-import-template/template.html: -------------------------------------------------------------------------------- 1 |

Setup Import Template

2 | 3 | -------------------------------------------------------------------------------- /packages/playground/vue/src-import/SrcImport.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/playground/vue/src-import/script.ts: -------------------------------------------------------------------------------- 1 | import { defineComponent } from 'vue' 2 | 3 | export default defineComponent({ 4 | setup() { 5 | return { 6 | msg: 'hello from script src!' 7 | } 8 | } 9 | }) 10 | -------------------------------------------------------------------------------- /packages/playground/vue/src-import/style.css: -------------------------------------------------------------------------------- 1 | .src-imports-style { 2 | color: tan; 3 | } 4 | -------------------------------------------------------------------------------- /packages/playground/vue/src-import/template.html: -------------------------------------------------------------------------------- 1 |

SFC Src Imports

2 |
{{ msg }}
3 |
This should be tan
4 | -------------------------------------------------------------------------------- /packages/playground/vue/vite.config.ts: -------------------------------------------------------------------------------- 1 | import path from 'path' 2 | import { defineConfig } from 'vite' 3 | import vuePlugin from '@vitejs/plugin-vue' 4 | import { vueI18nPlugin } from './CustomBlockPlugin' 5 | 6 | export default defineConfig({ 7 | resolve: { 8 | alias: { 9 | '/@': __dirname 10 | } 11 | }, 12 | plugins: [ 13 | vuePlugin({ 14 | refTransform: true 15 | }), 16 | vueI18nPlugin 17 | ], 18 | build: { 19 | // to make tests faster 20 | minify: false 21 | }, 22 | css: { 23 | modules: { 24 | localsConvention: 'camelCaseOnly' 25 | } 26 | } 27 | }) 28 | -------------------------------------------------------------------------------- /packages/playground/wasm/__tests__/wasm.spec.ts: -------------------------------------------------------------------------------- 1 | import { untilUpdated } from '../../testUtils' 2 | 3 | test('should work when inlined', async () => { 4 | await page.click('.inline-wasm .run') 5 | await untilUpdated(() => page.textContent('.inline-wasm .result'), '42') 6 | }) 7 | 8 | test('should work when output', async () => { 9 | await page.click('.output-wasm .run') 10 | await untilUpdated(() => page.textContent('.output-wasm .result'), '24') 11 | }) 12 | -------------------------------------------------------------------------------- /packages/playground/wasm/heavy.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/divriots/browser-vite/5721afb654901fd14b629f0b4d7eafe4587ea189/packages/playground/wasm/heavy.wasm -------------------------------------------------------------------------------- /packages/playground/wasm/light.wasm: -------------------------------------------------------------------------------- 1 | asm``imports imported_func exported_func 2 | A* -------------------------------------------------------------------------------- /packages/playground/wasm/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-wasm", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "vite build", 8 | "debug": "node --inspect-brk ../../vite/bin/vite", 9 | "preview": "vite preview" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/playground/worker/my-shared-worker.ts: -------------------------------------------------------------------------------- 1 | let count = 0 2 | const ports = new Set() 3 | 4 | onconnect = (event) => { 5 | const port = event.ports[0] 6 | ports.add(port) 7 | port.postMessage(count) 8 | port.onmessage = (message) => { 9 | if (message.data === 'tick') { 10 | count++ 11 | ports.forEach((p) => { 12 | p.postMessage(count) 13 | }) 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/playground/worker/my-worker.ts: -------------------------------------------------------------------------------- 1 | import { msg, mode } from './workerImport' 2 | 3 | self.onmessage = (e) => { 4 | if (e.data === 'ping') { 5 | self.postMessage({ msg, mode }) 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/playground/worker/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-worker", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "vite build", 8 | "debug": "node --inspect-brk ../../vite/bin/vite", 9 | "preview": "vite preview" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/playground/worker/possible-ts-output-worker.mjs: -------------------------------------------------------------------------------- 1 | import { msg, mode } from './workerImport' 2 | 3 | self.onmessage = (e) => { 4 | if (e.data === 'ping') { 5 | self.postMessage({ msg, mode }) 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/playground/worker/workerImport.js: -------------------------------------------------------------------------------- 1 | export const msg = 'pong' 2 | export const mode = process.env.NODE_ENV 3 | -------------------------------------------------------------------------------- /packages/plugin-react/src/babel.d.ts: -------------------------------------------------------------------------------- 1 | declare module '@babel/plugin-transform-react-jsx' 2 | declare module '@babel/plugin-transform-react-jsx-self' 3 | declare module '@babel/plugin-transform-react-jsx-source' 4 | declare module 'react-refresh/babel.js' 5 | -------------------------------------------------------------------------------- /packages/plugin-react/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": ["src"], 3 | "exclude": ["**/*.spec.ts"], 4 | "compilerOptions": { 5 | "outDir": "dist", 6 | "target": "ES2018", 7 | "module": "CommonJS", 8 | "moduleResolution": "Node", 9 | "strict": true, 10 | "declaration": true, 11 | "sourceMap": true, 12 | "noUnusedLocals": true, 13 | "esModuleInterop": true 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/plugin-vue-jsx/index.d.ts: -------------------------------------------------------------------------------- 1 | import { Plugin } from 'vite' 2 | import { VueJSXPluginOptions } from '@vue/babel-plugin-jsx' 3 | import { FilterPattern } from '@rollup/pluginutils' 4 | 5 | declare interface FilterOptions { 6 | include?: FilterPattern 7 | exclude?: FilterPattern 8 | } 9 | 10 | declare function createPlugin( 11 | options?: VueJSXPluginOptions & FilterOptions & { babelPlugins?: any[] } 12 | ): Plugin 13 | 14 | export default createPlugin 15 | -------------------------------------------------------------------------------- /packages/plugin-vue/src/helper.ts: -------------------------------------------------------------------------------- 1 | export const EXPORT_HELPER_ID = 'plugin-vue:export-helper' 2 | 3 | export const helperCode = ` 4 | export default (sfc, props) => { 5 | const target = sfc.__vccOpts || sfc; 6 | for (const [key, val] of props) { 7 | target[key] = val; 8 | } 9 | return target; 10 | } 11 | ` 12 | -------------------------------------------------------------------------------- /packages/vite/src/browser/server/index.ts: -------------------------------------------------------------------------------- 1 | import type { ResolvedServerOptions, ServerOptions } from '../../node/server' 2 | 3 | export function resolveServerOptions( 4 | root: string, 5 | raw?: ServerOptions 6 | ): ResolvedServerOptions { 7 | const server = raw || {} 8 | let allowDirs = server.fs?.allow 9 | const deny = server.fs?.deny || ['.env', '.env.*', '*.{crt,pem}'] 10 | 11 | if (!allowDirs) { 12 | allowDirs = [root] 13 | } 14 | 15 | server.fs = { 16 | strict: server.fs?.strict ?? true, 17 | allow: allowDirs, 18 | deny 19 | } 20 | return server as ResolvedServerOptions 21 | } 22 | -------------------------------------------------------------------------------- /packages/vite/src/browser/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "include": ["./", "../../types"], 4 | "compilerOptions": { 5 | "outDir": "../../dist/browser", 6 | "module": "esnext", 7 | "lib": ["ESNext", "DOM"], 8 | "sourceMap": true, 9 | "noUnusedLocals": false, 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/vite/src/client/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "include": ["./", "../../types"], 4 | "compilerOptions": { 5 | "outDir": "../../dist/client", 6 | "module": "esnext", 7 | "types": [], 8 | "lib": ["ESNext", "DOM"], 9 | "declaration": false 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/vite/src/node/__tests__/packages/name/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mylib" 3 | } 4 | -------------------------------------------------------------------------------- /packages/vite/src/node/__tests__/packages/noname/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /packages/vite/src/node/server/__tests__/fixtures/none/nested/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true 3 | } 4 | -------------------------------------------------------------------------------- /packages/vite/src/node/server/__tests__/fixtures/pnpm/nested/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true 3 | } 4 | -------------------------------------------------------------------------------- /packages/vite/src/node/server/__tests__/fixtures/pnpm/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true 3 | } 4 | -------------------------------------------------------------------------------- /packages/vite/src/node/server/__tests__/fixtures/pnpm/pnpm-workspace.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/divriots/browser-vite/5721afb654901fd14b629f0b4d7eafe4587ea189/packages/vite/src/node/server/__tests__/fixtures/pnpm/pnpm-workspace.yaml -------------------------------------------------------------------------------- /packages/vite/src/node/server/__tests__/fixtures/yarn/nested/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true 3 | } 4 | -------------------------------------------------------------------------------- /packages/vite/src/node/server/__tests__/fixtures/yarn/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "workspaces": [ 4 | "nested" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /packages/vite/src/node/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "include": ["./", "../../types"], 4 | "exclude": ["**/__tests__"], 5 | "compilerOptions": { 6 | // compile away optional-chaining-operator 7 | // node support table: https://node.green/#ES2020-features-optional-chaining-operator----- 8 | "target": "ES2019", 9 | "outDir": "../../dist/node", 10 | "module": "commonjs", 11 | "lib": ["ESNext"], 12 | "sourceMap": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/vite/tsconfig.base.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2018", 4 | "moduleResolution": "node", 5 | "strict": true, 6 | "declaration": true, 7 | "noImplicitOverride": true, 8 | "noUnusedLocals": true, 9 | "esModuleInterop": true, 10 | "useUnknownInCatchVariables": false 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/vite/types/anymatch.d.ts: -------------------------------------------------------------------------------- 1 | export type AnymatchFn = (testString: string) => boolean 2 | export type AnymatchPattern = string | RegExp | AnymatchFn 3 | type AnymatchMatcher = AnymatchPattern | AnymatchPattern[] 4 | 5 | export { AnymatchMatcher as Matcher } 6 | -------------------------------------------------------------------------------- /packages/vite/types/customEvent.d.ts: -------------------------------------------------------------------------------- 1 | // See https://stackoverflow.com/a/63549561. 2 | export type CustomEventName = (T extends `vite:${T}` 3 | ? never 4 | : T) & 5 | (`vite:${T}` extends T ? never : T) 6 | -------------------------------------------------------------------------------- /packages/vite/types/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "//": "this file is just here to make pnpm happy with --frozen-lockfile" 3 | } 4 | -------------------------------------------------------------------------------- /pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | packages: 2 | - 'packages/*' 3 | - 'packages/playground/**' 4 | -------------------------------------------------------------------------------- /scripts/jestGlobalTeardown.cjs: -------------------------------------------------------------------------------- 1 | const fs = require('fs-extra') 2 | const path = require('path') 3 | 4 | module.exports = async () => { 5 | await global.__BROWSER_SERVER__.close() 6 | if (!process.env.VITE_PRESERVE_BUILD_ARTIFACTS) { 7 | await fs.remove(path.resolve(__dirname, '../packages/temp')) 8 | } 9 | } 10 | --------------------------------------------------------------------------------