mirror of
https://github.com/vitejs/vite.git
synced 2024-11-21 22:59:10 +00:00
test: add tests for ssr.optimizeDeps.include
with dep1 > dep2
syntax (#16408)
This commit is contained in:
parent
61d0cfe03a
commit
ad9a987aa4
@ -119,6 +119,13 @@ test('import css library', async () => {
|
||||
expect(await page.textContent('.module-condition')).toMatch('[success]')
|
||||
})
|
||||
|
||||
test('optimize-deps-nested-include', async () => {
|
||||
await page.goto(url)
|
||||
expect(await page.textContent('.optimize-deps-nested-include')).toMatch(
|
||||
'nested-include',
|
||||
)
|
||||
})
|
||||
|
||||
describe.runIf(isServe)('hmr', () => {
|
||||
// TODO: the server file is not imported on the client at all
|
||||
// so it's not present in the client moduleGraph anymore
|
||||
|
3
playground/ssr-deps/nested-exclude/index.js
Normal file
3
playground/ssr-deps/nested-exclude/index.js
Normal file
@ -0,0 +1,3 @@
|
||||
export { default as nestedInclude } from '@vitejs/test-nested-include'
|
||||
|
||||
export default 'nested-exclude'
|
10
playground/ssr-deps/nested-exclude/package.json
Normal file
10
playground/ssr-deps/nested-exclude/package.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "@vitejs/test-nested-exclude",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"type": "module",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@vitejs/test-nested-include": "file:../nested-include"
|
||||
}
|
||||
}
|
2
playground/ssr-deps/nested-include/index.js
Normal file
2
playground/ssr-deps/nested-include/index.js
Normal file
@ -0,0 +1,2 @@
|
||||
// written in cjs, optimization should convert this to esm
|
||||
module.exports = 'nested-include'
|
6
playground/ssr-deps/nested-include/package.json
Normal file
6
playground/ssr-deps/nested-include/package.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "@vitejs/test-nested-include",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"main": "index.js"
|
||||
}
|
@ -26,6 +26,7 @@
|
||||
"@vitejs/test-non-optimized-with-nested-external": "workspace:*",
|
||||
"@vitejs/test-optimized-with-nested-external": "file:./optimized-with-nested-external",
|
||||
"@vitejs/test-optimized-cjs-with-nested-external": "file:./optimized-with-nested-external",
|
||||
"@vitejs/test-nested-exclude": "file:./nested-exclude",
|
||||
"@vitejs/test-external-using-external-entry": "file:./external-using-external-entry",
|
||||
"@vitejs/test-external-entry": "file:./external-entry",
|
||||
"@vitejs/test-linked-no-external": "link:./linked-no-external",
|
||||
|
@ -42,13 +42,20 @@ export async function createServer(root = process.cwd(), hmrPort) {
|
||||
},
|
||||
appType: 'custom',
|
||||
ssr: {
|
||||
noExternal,
|
||||
noExternal: [
|
||||
...noExternal,
|
||||
'@vitejs/test-nested-exclude',
|
||||
'@vitejs/test-nested-include',
|
||||
],
|
||||
external: [
|
||||
'@vitejs/test-nested-external',
|
||||
'@vitejs/test-external-entry/entry',
|
||||
],
|
||||
optimizeDeps: {
|
||||
include: noExternal,
|
||||
include: [
|
||||
...noExternal,
|
||||
'@vitejs/test-nested-exclude > @vitejs/test-nested-include',
|
||||
],
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
|
@ -23,6 +23,7 @@ import '@vitejs/test-non-optimized-with-nested-external'
|
||||
|
||||
import * as optimizedWithNestedExternal from '@vitejs/test-optimized-with-nested-external'
|
||||
import * as optimizedCjsWithNestedExternal from '@vitejs/test-optimized-cjs-with-nested-external'
|
||||
import * as optimizeDepsNestedInclude from '@vitejs/test-nested-exclude'
|
||||
|
||||
import { setMessage } from '@vitejs/test-external-entry/entry'
|
||||
setMessage('Hello World!')
|
||||
@ -94,5 +95,7 @@ export async function render(url, rootDir) {
|
||||
|
||||
html += `\n<p class="isomorphic-module-browser"></p>`
|
||||
|
||||
html += `\n<p class="optimize-deps-nested-include">message from optimize-deps-nested-include: ${optimizeDepsNestedInclude.nestedInclude}</p>`
|
||||
|
||||
return html + '\n'
|
||||
}
|
||||
|
@ -1372,6 +1372,9 @@ importers:
|
||||
'@vitejs/test-module-condition':
|
||||
specifier: file:./module-condition
|
||||
version: file:playground/ssr-deps/module-condition
|
||||
'@vitejs/test-nested-exclude':
|
||||
specifier: file:./nested-exclude
|
||||
version: file:playground/ssr-deps/nested-exclude
|
||||
'@vitejs/test-no-external-cjs':
|
||||
specifier: file:./no-external-cjs
|
||||
version: file:playground/ssr-deps/no-external-cjs
|
||||
@ -1442,10 +1445,18 @@ importers:
|
||||
|
||||
playground/ssr-deps/module-condition: {}
|
||||
|
||||
playground/ssr-deps/nested-exclude:
|
||||
dependencies:
|
||||
'@vitejs/test-nested-include':
|
||||
specifier: file:../nested-include
|
||||
version: file:playground/ssr-deps/nested-include
|
||||
|
||||
playground/ssr-deps/nested-external: {}
|
||||
|
||||
playground/ssr-deps/nested-external-cjs: {}
|
||||
|
||||
playground/ssr-deps/nested-include: {}
|
||||
|
||||
playground/ssr-deps/no-external-cjs: {}
|
||||
|
||||
playground/ssr-deps/no-external-css: {}
|
||||
@ -3357,12 +3368,18 @@ packages:
|
||||
'@vitejs/test-nested-exclude@file:playground/optimize-deps/nested-exclude':
|
||||
resolution: {directory: playground/optimize-deps/nested-exclude, type: directory}
|
||||
|
||||
'@vitejs/test-nested-exclude@file:playground/ssr-deps/nested-exclude':
|
||||
resolution: {directory: playground/ssr-deps/nested-exclude, type: directory}
|
||||
|
||||
'@vitejs/test-nested-external@file:playground/ssr-deps/nested-external':
|
||||
resolution: {directory: playground/ssr-deps/nested-external, type: directory}
|
||||
|
||||
'@vitejs/test-nested-include@file:playground/optimize-deps/nested-include':
|
||||
resolution: {directory: playground/optimize-deps/nested-include, type: directory}
|
||||
|
||||
'@vitejs/test-nested-include@file:playground/ssr-deps/nested-include':
|
||||
resolution: {directory: playground/ssr-deps/nested-include, type: directory}
|
||||
|
||||
'@vitejs/test-no-external-cjs@file:playground/ssr-deps/no-external-cjs':
|
||||
resolution: {directory: playground/ssr-deps/no-external-cjs, type: directory}
|
||||
|
||||
@ -8803,10 +8820,16 @@ snapshots:
|
||||
dependencies:
|
||||
'@vitejs/test-nested-include': file:playground/optimize-deps/nested-include
|
||||
|
||||
'@vitejs/test-nested-exclude@file:playground/ssr-deps/nested-exclude':
|
||||
dependencies:
|
||||
'@vitejs/test-nested-include': file:playground/ssr-deps/nested-include
|
||||
|
||||
'@vitejs/test-nested-external@file:playground/ssr-deps/nested-external': {}
|
||||
|
||||
'@vitejs/test-nested-include@file:playground/optimize-deps/nested-include': {}
|
||||
|
||||
'@vitejs/test-nested-include@file:playground/ssr-deps/nested-include': {}
|
||||
|
||||
'@vitejs/test-no-external-cjs@file:playground/ssr-deps/no-external-cjs': {}
|
||||
|
||||
'@vitejs/test-no-external-css@file:playground/ssr-deps/no-external-css': {}
|
||||
|
Loading…
Reference in New Issue
Block a user