-
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: cloudflare resolve conditions (#476)
- Loading branch information
Showing
8 changed files
with
839 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@astrojs/cloudflare': patch | ||
--- | ||
|
||
Removes resolving with "node" conditionto fix Vue imports |
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,9 @@ | ||
import cloudflare from '@astrojs/cloudflare'; | ||
import vue from "@astrojs/vue"; | ||
import { defineConfig } from 'astro/config'; | ||
|
||
export default defineConfig({ | ||
integrations: [vue()], | ||
adapter: cloudflare(), | ||
output: 'server', | ||
}); |
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,11 @@ | ||
{ | ||
"name": "@test/astro-cloudflare-with-vue", | ||
"version": "0.0.0", | ||
"private": true, | ||
"dependencies": { | ||
"@astrojs/cloudflare": "workspace:*", | ||
"@astrojs/vue": "^5.0.1", | ||
"astro": "^5.0.0", | ||
"vue": "^3.5.13" | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/cloudflare/test/fixtures/with-vue/src/components/Component.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,3 @@ | ||
<template> | ||
<div class="vue">Vue Content</div> | ||
</template> |
13 changes: 13 additions & 0 deletions
13
packages/cloudflare/test/fixtures/with-vue/src/pages/index.astro
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 Component from '../components/Component.vue'; | ||
--- | ||
|
||
<html> | ||
<head> | ||
<title>Testing</title> | ||
</head> | ||
<body> | ||
<h1>Testing</h1> | ||
<Component /> | ||
</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,37 @@ | ||
import * as assert from 'node:assert/strict'; | ||
import { after, before, describe, it } from 'node:test'; | ||
import { fileURLToPath } from 'node:url'; | ||
import * as cheerio from 'cheerio'; | ||
import { astroCli, wranglerCli } from './_test-utils.js'; | ||
|
||
const root = new URL('./fixtures/with-vue/', import.meta.url); | ||
|
||
describe('Vue', () => { | ||
let wrangler; | ||
before(async () => { | ||
await astroCli(fileURLToPath(root), 'build'); | ||
|
||
wrangler = wranglerCli(fileURLToPath(root)); | ||
await new Promise((resolve) => { | ||
wrangler.stdout.on('data', (data) => { | ||
// console.log('[stdout]', data.toString()); | ||
if (data.toString().includes('http://127.0.0.1:8788')) resolve(); | ||
}); | ||
wrangler.stderr.on('data', (data) => { | ||
// console.log('[stderr]', data.toString()); | ||
}); | ||
}); | ||
}); | ||
|
||
after((done) => { | ||
wrangler.kill(); | ||
}); | ||
|
||
it('renders the vue component', async () => { | ||
const res = await fetch('http://127.0.0.1:8788/'); | ||
assert.equal(res.status, 200); | ||
const html = await res.text(); | ||
const $ = cheerio.load(html); | ||
assert.equal($('.vue').text(), 'Vue Content'); | ||
}); | ||
}); |
Oops, something went wrong.