diff --git a/.npmrc b/.npmrc new file mode 100644 index 000000000..4abbb42e5 --- /dev/null +++ b/.npmrc @@ -0,0 +1,7 @@ +hoist-pattern[]=*eslint* +hoist-pattern[]=*babel* +hoist-pattern[]=*jest* +hoist-pattern[]=@emotion/* +hoist-pattern[]=postcss +hoist-pattern[]=pug +hoist-pattern[]=source-map-support diff --git a/packages/playground/backend-integration/package.json b/packages/playground/backend-integration/package.json index afbdb63d3..b3d9b064d 100644 --- a/packages/playground/backend-integration/package.json +++ b/packages/playground/backend-integration/package.json @@ -10,5 +10,8 @@ }, "dependencies": { "tailwindcss": "^2.2.19" + }, + "devDependencies": { + "fast-glob": "^3.2.11" } } diff --git a/packages/playground/css/__tests__/postcss-plugins-different-dir.spec.ts b/packages/playground/css/__tests__/postcss-plugins-different-dir.spec.ts new file mode 100644 index 000000000..48500740b --- /dev/null +++ b/packages/playground/css/__tests__/postcss-plugins-different-dir.spec.ts @@ -0,0 +1,29 @@ +import { getColor, getBgColor } from '../../testUtils' +import { createServer } from 'vite' +import path from 'path' + +// Regression test for https://github.com/vitejs/vite/issues/4000 +test('postcss plugins in different dir', async () => { + const port = 5005 + const server = await createServer({ + root: path.join(__dirname, '..', '..', 'tailwind'), + logLevel: 'silent', + server: { + port, + strictPort: true + }, + build: { + // skip transpilation during tests to make it faster + target: 'esnext' + } + }) + await server.listen() + try { + await page.goto(`http://localhost:${port}`) + const tailwindStyle = await page.$('.tailwind-style') + expect(await getBgColor(tailwindStyle)).toBe('rgb(254, 226, 226)') + expect(await getColor(tailwindStyle)).toBe('rgb(136, 136, 136)') + } finally { + await server.close() + } +}) diff --git a/packages/playground/css/package.json b/packages/playground/css/package.json index 13a588745..b45063100 100644 --- a/packages/playground/css/package.json +++ b/packages/playground/css/package.json @@ -10,6 +10,7 @@ }, "devDependencies": { "css-dep": "link:./css-dep", + "fast-glob": "^3.2.11", "less": "^4.1.2", "postcss-nested": "^5.0.6", "sass": "^1.43.4", diff --git a/packages/playground/legacy/package.json b/packages/playground/legacy/package.json index 177aa5a0a..3a3315c42 100644 --- a/packages/playground/legacy/package.json +++ b/packages/playground/legacy/package.json @@ -10,6 +10,7 @@ "preview": "vite preview" }, "devDependencies": { - "@vitejs/plugin-legacy": "workspace:*" + "@vitejs/plugin-legacy": "workspace:*", + "express": "^4.17.1" } } diff --git a/packages/playground/multiple-entrypoints/package.json b/packages/playground/multiple-entrypoints/package.json index 7b4dab889..6c338a645 100644 --- a/packages/playground/multiple-entrypoints/package.json +++ b/packages/playground/multiple-entrypoints/package.json @@ -7,5 +7,9 @@ "build": "vite build", "debug": "node --inspect-brk ../../vite/bin/vite", "preview": "vite preview" + }, + "devDependencies": { + "fast-glob": "^3.2.11", + "sass": "^1.43.4" } } diff --git a/packages/playground/tailwind/src/views/Page.vue b/packages/playground/tailwind/src/views/Page.vue index ec59b4423..764a2a18e 100644 --- a/packages/playground/tailwind/src/views/Page.vue +++ b/packages/playground/tailwind/src/views/Page.vue @@ -2,7 +2,9 @@

|Page title|

{{ val }}
-
+
Tailwind style
diff --git a/packages/playground/testUtils.ts b/packages/playground/testUtils.ts index 0ae0c6e87..0c8186d4e 100644 --- a/packages/playground/testUtils.ts +++ b/packages/playground/testUtils.ts @@ -64,6 +64,11 @@ export async function getBg(el: string | ElementHandle): Promise { return el.evaluate((el) => getComputedStyle(el as Element).backgroundImage) } +export async function getBgColor(el: string | ElementHandle): Promise { + el = await toEl(el) + return el.evaluate((el) => getComputedStyle(el as Element).backgroundColor) +} + export function readFile(filename: string): string { return fs.readFileSync(path.resolve(testDir, filename), 'utf-8') } diff --git a/packages/playground/vue/public/favicon.ico b/packages/playground/vue/public/favicon.ico new file mode 100644 index 000000000..df36fcfb7 Binary files /dev/null and b/packages/playground/vue/public/favicon.ico differ diff --git a/packages/vite/LICENSE.md b/packages/vite/LICENSE.md index 8b4d641a0..107329e4f 100644 --- a/packages/vite/LICENSE.md +++ b/packages/vite/LICENSE.md @@ -3088,7 +3088,7 @@ Repository: https://github.com/postcss/postcss-import.git ## postcss-load-config License: MIT -By: Michael Ciniawky, Ryan Dunckel, Mateusz Derks, Dalton Santos, Patrick Gilday +By: Michael Ciniawky, Ryan Dunckel, Mateusz Derks, Dalton Santos, Patrick Gilday, François Wouts Repository: postcss/postcss-load-config > The MIT License (MIT) diff --git a/packages/vite/package.json b/packages/vite/package.json index 2e0baac21..f790184bf 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -104,7 +104,7 @@ "periscopic": "^2.0.3", "picocolors": "^1.0.0", "postcss-import": "^14.0.2", - "postcss-load-config": "^3.1.1", + "postcss-load-config": "^3.1.3", "postcss-modules": "^4.3.0", "resolve.exports": "^1.1.0", "rollup-plugin-license": "^2.6.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0b5ce9e20..b7a9a8e96 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -115,9 +115,12 @@ importers: packages/playground/backend-integration: specifiers: + fast-glob: ^3.2.11 tailwindcss: ^2.2.19 dependencies: tailwindcss: 2.2.19_ts-node@10.4.0 + devDependencies: + fast-glob: 3.2.11 packages/playground/cli: specifiers: {} @@ -128,12 +131,14 @@ importers: packages/playground/css: specifiers: css-dep: link:./css-dep + fast-glob: ^3.2.11 less: ^4.1.2 postcss-nested: ^5.0.6 sass: ^1.43.4 stylus: ^0.55.0 devDependencies: css-dep: link:css-dep + fast-glob: 3.2.11 less: 4.1.2 postcss-nested: 5.0.6 sass: 1.45.1 @@ -215,14 +220,21 @@ importers: packages/playground/legacy: specifiers: '@vitejs/plugin-legacy': workspace:* + express: ^4.17.1 devDependencies: '@vitejs/plugin-legacy': link:../../plugin-legacy + express: 4.17.2 packages/playground/lib: specifiers: {} packages/playground/multiple-entrypoints: - specifiers: {} + specifiers: + fast-glob: ^3.2.11 + sass: ^1.43.4 + devDependencies: + fast-glob: 3.2.11 + sass: 1.45.1 packages/playground/nested-deps: specifiers: @@ -797,7 +809,7 @@ importers: picocolors: ^1.0.0 postcss: ^8.4.6 postcss-import: ^14.0.2 - postcss-load-config: ^3.1.1 + postcss-load-config: ^3.1.3 postcss-modules: ^4.3.0 resolve: ^1.22.0 resolve.exports: ^1.1.0 @@ -872,7 +884,7 @@ importers: periscopic: 2.0.3 picocolors: 1.0.0 postcss-import: 14.0.2_postcss@8.4.6 - postcss-load-config: 3.1.1_ts-node@10.4.0 + postcss-load-config: 3.1.3_ts-node@10.4.0 postcss-modules: 4.3.0_postcss@8.4.6 resolve.exports: 1.1.0 rollup-plugin-license: 2.6.1_rollup@2.62.0 @@ -4816,7 +4828,6 @@ packages: glob-parent: 5.1.2 merge2: 1.4.1 micromatch: 4.0.4 - dev: true /fast-glob/3.2.7: resolution: {integrity: sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q==} @@ -4827,6 +4838,7 @@ packages: glob-parent: 5.1.2 merge2: 1.4.1 micromatch: 4.0.4 + dev: true /fast-json-stable-stringify/2.1.0: resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==} @@ -6145,7 +6157,7 @@ packages: '@types/node': 16.11.22 chalk: 4.1.2 ci-info: 3.3.0 - graceful-fs: 4.2.8 + graceful-fs: 4.2.9 picomatch: 2.3.0 dev: true @@ -7355,8 +7367,8 @@ packages: yaml: 1.10.2 dev: false - /postcss-load-config/3.1.1_ts-node@10.4.0: - resolution: {integrity: sha512-c/9XYboIbSEUZpiD1UQD0IKiUe8n9WHYV7YFe7X7J+ZwCsEKkUJSFWjS9hBU1RR9THR7jMXst8sxiqP0jjo2mg==} + /postcss-load-config/3.1.3_ts-node@10.4.0: + resolution: {integrity: sha512-5EYgaM9auHGtO//ljHH+v/aC/TQ5LHXtL7bQajNAUBKUVKiYE8rYpFms7+V26D9FncaGe2zwCoPQsFKb5zF/Hw==} engines: {node: '>= 10'} peerDependencies: ts-node: '>=9.0.0' @@ -8616,7 +8628,7 @@ packages: detective: 5.2.0 didyoumean: 1.2.2 dlv: 1.1.3 - fast-glob: 3.2.7 + fast-glob: 3.2.11 fs-extra: 10.0.0 glob-parent: 6.0.2 html-tags: 3.1.0 @@ -8660,7 +8672,7 @@ packages: detective: 5.2.0 didyoumean: 1.2.2 dlv: 1.1.3 - fast-glob: 3.2.7 + fast-glob: 3.2.11 fs-extra: 10.0.0 glob-parent: 6.0.2 html-tags: 3.1.0