From fcf636d647c19c69cccf1cad788614e3311c91db Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Mon, 26 Sep 2022 20:22:20 +0100 Subject: [PATCH] test: skip checking for css in vite build --- src/vite/manifest.ts | 4 ++-- test/bridge.test.ts | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/vite/manifest.ts b/src/vite/manifest.ts index 87a17faf..d1ce9dc2 100644 --- a/src/vite/manifest.ts +++ b/src/vite/manifest.ts @@ -95,8 +95,8 @@ export async function generateBuildManifest (ctx: ViteBuildContext) { 'var appConfig = window && window.__NUXT__ && window.__NUXT__.config.app || {}', 'var publicBase = appConfig.cdnURL || appConfig.baseURL || "/"', 'function joinURL (a, b) { return a[a.length -1] !== "/" ? a + "/" + b : a + b }', - 'globalThis.__publicAssetsURL = function(id) { return joinURL(publicBase, id) }', - 'globalThis.__buildAssetsURL = function(id) { return joinURL(publicBase, joinURL(appConfig.buildAssetsDir, id)) }', + 'globalThis.__publicAssetsURL = function(id) { return joinURL(publicBase, id || "") }', + 'globalThis.__buildAssetsURL = function(id) { return joinURL(publicBase, joinURL(appConfig.buildAssetsDir, id || "")) }', `var imports = ${JSON.stringify([...clientImports])};`, 'imports.reduce(function(p, id){return p.then(function(){return System.import(__buildAssetsURL(id).slice(1))})}, Promise.resolve())' ].join('\n') diff --git a/test/bridge.test.ts b/test/bridge.test.ts index 175d3919..9dca3a87 100644 --- a/test/bridge.test.ts +++ b/test/bridge.test.ts @@ -82,7 +82,8 @@ describe('dynamic paths', () => { await expectNoClientErrors('/assets') }) - it('adds relative paths to CSS', async () => { + // Vite legacy build does not emit CSS files + it.skipIf(!process.env.TEST_WITH_WEBPACK)('adds relative paths to CSS', async () => { const html = await $fetch('/assets') const urls = Array.from(html.matchAll(/(href|src)="(.*?)"/g)).map(m => m[2]) const cssURL = urls.find(u => /_nuxt\/assets.*\.css$/.test(u))