Skip to content

Commit

Permalink
fix: remove unnecessary static alias logic
Browse files Browse the repository at this point in the history
fix #1826
  • Loading branch information
yyx990803 committed Feb 1, 2021
1 parent e40e6b2 commit 23bd257
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
14 changes: 12 additions & 2 deletions packages/playground/alias/__tests__/alias.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { editFile, getColor, untilUpdated } from '../../testUtils'

test('fs', async () => {
expect(await page.textContent('.fs')).toMatch('[success] alias to fs path')
})
Expand All @@ -18,8 +20,16 @@ test('dependency', async () => {
expect(await page.textContent('.dep')).toMatch('[success] out of root')
})

test('from html', async () => {
expect(await page.textContent('.from-html')).toMatch('[success] from html')
test('js via script src', async () => {
expect(await page.textContent('.from-script-src')).toMatch(
'[success] from script src'
)
})

test('css via link', async () => {
expect(await getColor('body')).toBe('grey')
editFile('dir/test.css', (code) => code.replace('grey', 'red'))
await untilUpdated(() => getColor('body'), 'red')
})

test('optimized dep', async () => {
Expand Down
1 change: 0 additions & 1 deletion packages/playground/alias/dir/from-html.js

This file was deleted.

2 changes: 2 additions & 0 deletions packages/playground/alias/dir/from-script-src.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
document.querySelector('.from-script-src').textContent =
'[success] from script src'
3 changes: 3 additions & 0 deletions packages/playground/alias/dir/test.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body {
color: grey;
}
5 changes: 3 additions & 2 deletions packages/playground/alias/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ <h1>Alias</h1>
<p class="fs-dir"></p>
<p class="regex"></p>
<p class="dep"></p>
<p class="from-html"></p>
<p class="from-script-src"></p>

<div class="optimized"></div>

Expand Down Expand Up @@ -37,4 +37,5 @@ <h1>Alias</h1>
}).mount('.optimized')
</script>

<script type="module" src="/@/from-html.js"></script>
<script type="module" src="/@/from-script-src.js"></script>
<link rel="stylesheet" href="/@/test.css" />

0 comments on commit 23bd257

Please sign in to comment.