-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Improve Vue appEntrypoint handling
#8794
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
natemoo-re
merged 15 commits into
withastro:main
from
yoyo837:fix-app-no-default-export-fn
Dec 5, 2023
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
e935aa5
chore: improve app setup call
yoyo837 987f3d5
changeset
yoyo837 5dd2627
Update .changeset/smart-cameras-kneel.md
yoyo837 42784d5
chore: add test case
yoyo837 97af50c
test: update test case
yoyo837 6f57423
fix: rollup errors
florian-lefebvre 5facd9a
Update smart-cameras-kneel.md
florian-lefebvre cf39cb8
Update .changeset/smart-cameras-kneel.md
florian-lefebvre 1b1a8b9
Discard changes to packages/integrations/vue/client.js
florian-lefebvre c811cb6
chore: add fixture for relative appEntrypoint
natemoo-re db8b963
fix: simplify appEntrypoint resolution via Vite
natemoo-re b2e3698
chore: update lockfile
natemoo-re 30bf5c7
Discard changes to packages/integrations/vue/server.js
florian-lefebvre 8664749
Update packages/integrations/vue/src/index.ts
natemoo-re 2500fdc
Merge branch 'main' into fix-app-no-default-export-fn
natemoo-re File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,5 @@ | ||
| --- | ||
| '@astrojs/vue': patch | ||
| --- | ||
|
|
||
| Prevents Astro from crashing when no default function is exported from the `appEntrypoint`. Now, the entrypoint will be ignored with a warning instead. |
This file contains hidden or 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 hidden or 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
14 changes: 14 additions & 0 deletions
14
packages/integrations/vue/test/fixtures/app-entrypoint-no-export-default/astro.config.mjs
This file contains hidden or 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,14 @@ | ||
| import { defineConfig } from 'astro/config'; | ||
| import vue from '@astrojs/vue'; | ||
| import ViteSvgLoader from 'vite-svg-loader' | ||
|
|
||
| export default defineConfig({ | ||
| integrations: [vue({ | ||
| appEntrypoint: '/src/pages/_app' | ||
| })], | ||
| vite: { | ||
| plugins: [ | ||
| ViteSvgLoader(), | ||
| ], | ||
| }, | ||
| }) |
13 changes: 13 additions & 0 deletions
13
packages/integrations/vue/test/fixtures/app-entrypoint-no-export-default/package.json
This file contains hidden or 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 @@ | ||
| { | ||
| "name": "@test/vue-app-entrypoint-no-export-default", | ||
| "version": "0.0.0", | ||
| "private": true, | ||
| "scripts": { | ||
| "astro": "astro" | ||
| }, | ||
| "dependencies": { | ||
| "@astrojs/vue": "workspace:*", | ||
| "astro": "workspace:*", | ||
| "vite-svg-loader": "4.0.0" | ||
| } | ||
| } |
3 changes: 3 additions & 0 deletions
3
...es/integrations/vue/test/fixtures/app-entrypoint-no-export-default/src/components/Bar.vue
This file contains hidden or 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 @@ | ||
| <template> | ||
| <div id="bar">works</div> | ||
| </template> |
1 change: 1 addition & 0 deletions
1
...ns/vue/test/fixtures/app-entrypoint-no-export-default/src/components/Circle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions
11
...es/integrations/vue/test/fixtures/app-entrypoint-no-export-default/src/components/Foo.vue
This file contains hidden or 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,11 @@ | ||
| <script setup> | ||
| import Bar from './Bar.vue' | ||
| import Circle from './Circle.svg?component' | ||
| </script> | ||
|
|
||
| <template> | ||
| <div id="foo"> | ||
| <Bar /> | ||
| <Circle/> | ||
| </div> | ||
| </template> |
3 changes: 3 additions & 0 deletions
3
packages/integrations/vue/test/fixtures/app-entrypoint-no-export-default/src/pages/_app.ts
This file contains hidden or 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 @@ | ||
| console.log(123); | ||
|
|
||
| // no default export |
12 changes: 12 additions & 0 deletions
12
...ges/integrations/vue/test/fixtures/app-entrypoint-no-export-default/src/pages/index.astro
This file contains hidden or 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,12 @@ | ||
| --- | ||
| import Foo from '../components/Foo.vue'; | ||
| --- | ||
|
|
||
| <html> | ||
| <head> | ||
| <title>Vue App Entrypoint</title> | ||
| </head> | ||
| <body> | ||
| <Foo client:load /> | ||
| </body> | ||
| </html> |
8 changes: 8 additions & 0 deletions
8
packages/integrations/vue/test/fixtures/app-entrypoint-relative/astro.config.mjs
This file contains hidden or 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,8 @@ | ||
| import { defineConfig } from 'astro/config'; | ||
| import vue from '@astrojs/vue'; | ||
|
|
||
| export default defineConfig({ | ||
| integrations: [vue({ | ||
| appEntrypoint: './src/vue.ts' | ||
| })] | ||
| }) |
12 changes: 12 additions & 0 deletions
12
packages/integrations/vue/test/fixtures/app-entrypoint-relative/package.json
This file contains hidden or 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,12 @@ | ||
| { | ||
| "name": "@test/vue-app-entrypoint-relative", | ||
| "version": "0.0.0", | ||
| "private": true, | ||
| "scripts": { | ||
| "astro": "astro" | ||
| }, | ||
| "dependencies": { | ||
| "@astrojs/vue": "workspace:*", | ||
| "astro": "workspace:*" | ||
| } | ||
| } |
3 changes: 3 additions & 0 deletions
3
packages/integrations/vue/test/fixtures/app-entrypoint-relative/src/components/Bar.vue
This file contains hidden or 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 @@ | ||
| <template> | ||
| <div id="bar">works</div> | ||
| </template> |
1 change: 1 addition & 0 deletions
1
...ntegrations/vue/test/fixtures/app-entrypoint-relative/src/components/Circle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions
11
packages/integrations/vue/test/fixtures/app-entrypoint-relative/src/components/Foo.vue
This file contains hidden or 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,11 @@ | ||
| <script setup> | ||
| import Bar from './Bar.vue' | ||
| import Circle from './Circle.svg?component' | ||
| </script> | ||
|
|
||
| <template> | ||
| <div id="foo"> | ||
| <Bar /> | ||
| <Circle/> | ||
| </div> | ||
| </template> |
12 changes: 12 additions & 0 deletions
12
packages/integrations/vue/test/fixtures/app-entrypoint-relative/src/pages/index.astro
This file contains hidden or 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,12 @@ | ||
| --- | ||
| import Foo from '../components/Foo.vue'; | ||
| --- | ||
|
|
||
| <html> | ||
| <head> | ||
| <title>Vue App Entrypoint</title> | ||
| </head> | ||
| <body> | ||
| <Foo client:load /> | ||
| </body> | ||
| </html> |
1 change: 1 addition & 0 deletions
1
packages/integrations/vue/test/fixtures/app-entrypoint-relative/src/vue.ts
This file contains hidden or 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 @@ | ||
| export default () => {} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.