Skip to content
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

fix: legacy no resolve asset urls #9507

Merged
merged 42 commits into from Aug 19, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
8900c1c
test: vue legacy
poyoho Aug 3, 2022
b9130cc
feat: resolveAssetUrlsInCss in legacy mode
poyoho Aug 3, 2022
536cd5e
feat: test hook for legacy
poyoho Aug 4, 2022
72d8aef
fix: relative path for legacy mode
poyoho Aug 5, 2022
d909dee
fix: test
poyoho Aug 5, 2022
6e08b1d
feat: ignore entry chunk insert css
poyoho Aug 6, 2022
c1eb9b0
fix: error
poyoho Aug 6, 2022
a0caa7c
chore: update comment
poyoho Aug 6, 2022
18bec1b
chore: update
poyoho Aug 10, 2022
0b4c3cc
chore: update
poyoho Aug 10, 2022
fb734fa
chore: update
poyoho Aug 10, 2022
53bfcf6
chore: revert avoid generate the css insert script
poyoho Aug 10, 2022
43c64ae
chore: update
poyoho Aug 10, 2022
2d7812a
chore: update
poyoho Aug 10, 2022
f684b78
chore: renderAssetUrl helper
poyoho Aug 16, 2022
b6083fb
chore: update
poyoho Aug 16, 2022
2fd5069
fix: cssAssetDirname
poyoho Aug 16, 2022
2ae6788
chore: rebase
poyoho Aug 16, 2022
46d57b0
feat: opts
poyoho Aug 16, 2022
1a50884
fix: types
poyoho Aug 16, 2022
ecd950b
chore: don't modify resolveAssetUrlsInCss
poyoho Aug 17, 2022
57b3595
chore: revert resolveAssetUrlsInCss
poyoho Aug 17, 2022
e91fe24
chore: update
poyoho Aug 17, 2022
86af81d
chore: update
poyoho Aug 17, 2022
45dfb22
feat: no wrap
poyoho Aug 17, 2022
32fbeb3
chore: update
poyoho Aug 17, 2022
b682325
chore: update
poyoho Aug 17, 2022
297b765
chore: update
poyoho Aug 17, 2022
9e179df
fix: test
poyoho Aug 17, 2022
59f6a26
chore: update
poyoho Aug 17, 2022
b30a5c9
feat: vitest __test__ hooks
poyoho Aug 17, 2022
7f49b78
fix: systemjs wrapper
poyoho Aug 17, 2022
8422fbc
feat: one more judge
poyoho Aug 17, 2022
58eeb69
chore: update
poyoho Aug 18, 2022
7e97059
chore: update
poyoho Aug 18, 2022
e3c098e
test: for async legacy chunk
poyoho Aug 18, 2022
8e95e3f
feat: systemjsWrapCompletePlugin
poyoho Aug 18, 2022
4b0b731
chore: update
poyoho Aug 18, 2022
0307aeb
chore: update
poyoho Aug 18, 2022
9c1a625
chore: update
poyoho Aug 18, 2022
3b72036
chore: update
poyoho Aug 19, 2022
8df22e9
chore: update
poyoho Aug 19, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/vite/src/node/plugins/css.ts
Expand Up @@ -558,8 +558,7 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
} else if (!config.build.ssr) {
// legacy build and inline css

// __VITE_ASSET__ and __VITE_PUBLIC_ASSET__ urls are processed by
// the vite:asset plugin, don't call resolveAssetUrlsInCss here
chunkCSS = resolveAssetUrlsInCss(chunkCSS, chunk.name)
poyoho marked this conversation as resolved.
Show resolved Hide resolved
chunkCSS = await finalizeCss(chunkCSS, true, config)

const style = `__vite_style__`
Expand Down
13 changes: 13 additions & 0 deletions playground/vue-legacy/Main.vue
@@ -0,0 +1,13 @@
<template>
<div class="container">
<p>hello</p>
</div>
</template>
<style scoped>
.container {
height: 100vh;
background: url('@/assets/asset.png') no-repeat;
poyoho marked this conversation as resolved.
Show resolved Hide resolved
background-size: contain;
background-position: center;
}
</style>
6 changes: 6 additions & 0 deletions playground/vue-legacy/__tests__/vue-legacy.spec.ts
@@ -0,0 +1,6 @@
import { getBg, page } from '~utils'

test('vue legacy assets', async () => {
const el = await page.$('.container')
expect(await getBg(el)).not.toMatch('__VITE_ASSET__')
})
Binary file added playground/vue-legacy/assets/asset.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions playground/vue-legacy/env.d.ts
@@ -0,0 +1 @@
declare module '*.png'
7 changes: 7 additions & 0 deletions playground/vue-legacy/index.html
@@ -0,0 +1,7 @@
<div id="app"></div>
<script type="module">
import { createApp } from 'vue'
import Main from './Main.vue'

createApp(Main).mount('#app')
</script>
18 changes: 18 additions & 0 deletions playground/vue-legacy/package.json
@@ -0,0 +1,18 @@
{
"name": "test-vue-legacy",
"private": true,
"version": "0.0.0",
"scripts": {
"dev": "vite",
"build": "vite build",
"debug": "node --inspect-brk ../../packages/vite/bin/vite",
"preview": "vite preview"
},
"dependencies": {
"vue": "^3.2.37"
},
"devDependencies": {
"@vitejs/plugin-vue": "workspace:*",
"@vitejs/plugin-legacy": "workspace:*"
}
}
21 changes: 21 additions & 0 deletions playground/vue-legacy/vite.config.ts
@@ -0,0 +1,21 @@
import { defineConfig } from 'vite'
import vuePlugin from '@vitejs/plugin-vue'
import legacyPlugin from '@vitejs/plugin-legacy'

export default defineConfig({
base: '',
resolve: {
alias: {
'@': __dirname
}
},
plugins: [
legacyPlugin({
targets: ['defaults', 'not IE 11', 'chrome > 48']
}),
vuePlugin()
],
build: {
minify: false
}
poyoho marked this conversation as resolved.
Show resolved Hide resolved
})
11 changes: 11 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.