-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: respect
rollupOptions.external
for transitive dependencies (#8679
- Loading branch information
1 parent
0cbb33b
commit 4f9097b
Showing
11 changed files
with
207 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { isBuild, page } from '~utils' | ||
|
||
describe.runIf(isBuild)('build', () => { | ||
test('should externalize imported packages', async () => { | ||
// If `vue` is successfully externalized, the page should use the version from the import map | ||
expect(await page.textContent('#imported-vue-version')).toBe('3.2.0') | ||
}) | ||
|
||
test('should externalize required packages', async () => { | ||
// If `vue` is successfully externalized, the page should use the version from the import map | ||
expect(await page.textContent('#required-vue-version')).toBe('3.2.0') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { version } from 'vue' | ||
|
||
document.querySelector('#imported-vue-version').textContent = version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "@vitejs/dep-that-imports-vue", | ||
"version": "0.0.1", | ||
"dependencies": { | ||
"vue": "^3.2.37" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const { version } = require('vue') | ||
|
||
document.querySelector('#required-vue-version').textContent = version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "@vitejs/dep-that-requires-vue", | ||
"version": "0.0.1", | ||
"dependencies": { | ||
"vue": "^3.2.37" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Vite App</title> | ||
<script type="importmap"> | ||
{ | ||
"imports": { | ||
"vue": "https://unpkg.com/[email protected]/dist/vue.runtime.esm-browser.js" | ||
} | ||
} | ||
</script> | ||
</head> | ||
<body> | ||
<p>Imported Vue version: <span id="imported-vue-version"></span></p> | ||
<p>Required Vue version: <span id="required-vue-version"></span></p> | ||
<script type="module" src="/src/main.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "external-test", | ||
"private": true, | ||
"version": "0.0.0", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "vite build", | ||
"debug": "node --inspect-brk ../../packages/vite/bin/vite", | ||
"preview": "vite preview" | ||
}, | ||
"dependencies": { | ||
"@vitejs/dep-that-imports-vue": "file:./dep-that-imports-vue", | ||
"@vitejs/dep-that-requires-vue": "file:./dep-that-requires-vue" | ||
}, | ||
"devDependencies": { | ||
"vite": "workspace:*", | ||
"vue": "^3.2.37" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import '@vitejs/dep-that-imports-vue' | ||
import '@vitejs/dep-that-requires-vue' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { defineConfig } from 'vite' | ||
|
||
export default defineConfig({ | ||
build: { | ||
minify: false, | ||
rollupOptions: { | ||
external: ['vue'] | ||
} | ||
} | ||
}) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.