Revert "feat(vite): use the project's tsconfig.json to configure plug… (#13415)

This commit is contained in:
Jack Hsu 2022-11-25 14:46:37 -05:00 committed by GitHub
parent 2c13661b90
commit c0f12757f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 13 deletions

File diff suppressed because one or more lines are too long

View File

@ -170,7 +170,7 @@ export default defineConfig({
react(), react(),
ViteTsConfigPathsPlugin({ ViteTsConfigPathsPlugin({
root: '../../', root: '../../',
projects: ['./tsconfig.json'], projects: ['tsconfig.base.json'],
}), }),
], ],
}); });
@ -213,7 +213,7 @@ export default mergeConfig(baseConfig, {
react(), react(),
ViteTsConfigPathsPlugin({ ViteTsConfigPathsPlugin({
root: '../../', root: '../../',
projects: ['./tsconfig.json'], projects: ['tsconfig.base.json'],
}), }),
], ],
}); });

View File

@ -84,7 +84,6 @@ describe('Vite Plugin', () => {
`apps/${myApp}/vite.config.ts`, `apps/${myApp}/vite.config.ts`,
` `
/// <reference types="vitest" /> /// <reference types="vitest" />
import { join } from 'path';
import { defineConfig } from 'vite'; import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react'; import react from '@vitejs/plugin-react';
import plugin from 'vite-tsconfig-paths'; import plugin from 'vite-tsconfig-paths';
@ -94,7 +93,7 @@ describe('Vite Plugin', () => {
react(), react(),
plugin({ plugin({
root: '../../', root: '../../',
projects: [join(__dirname, 'tsconfig.json')], projects: ['tsconfig.base.json'],
}), }),
], ],
test: { test: {

View File

@ -103,7 +103,6 @@ describe('vitest generator', () => {
expect(viteConfig).toMatchInlineSnapshot(` expect(viteConfig).toMatchInlineSnapshot(`
" "
/// <reference types=\\"vitest\\" /> /// <reference types=\\"vitest\\" />
import { join } from 'path';
import { defineConfig } from 'vite'; import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react'; import react from '@vitejs/plugin-react';
import ViteTsConfigPathsPlugin from 'vite-tsconfig-paths'; import ViteTsConfigPathsPlugin from 'vite-tsconfig-paths';
@ -113,7 +112,7 @@ describe('vitest generator', () => {
react(), react(),
ViteTsConfigPathsPlugin({ ViteTsConfigPathsPlugin({
root: '../../', root: '../../',
projects: [join(__dirname, 'tsconfig.json')], projects: ['tsconfig.base.json'],
}), }),
], ],
@ -137,7 +136,6 @@ describe('vitest generator', () => {
expect(viteConfig).toMatchInlineSnapshot(` expect(viteConfig).toMatchInlineSnapshot(`
" "
/// <reference types=\\"vitest\\" /> /// <reference types=\\"vitest\\" />
import { join } from 'path';
import { defineConfig } from 'vite'; import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react'; import react from '@vitejs/plugin-react';
import ViteTsConfigPathsPlugin from 'vite-tsconfig-paths'; import ViteTsConfigPathsPlugin from 'vite-tsconfig-paths';
@ -147,7 +145,7 @@ describe('vitest generator', () => {
react(), react(),
ViteTsConfigPathsPlugin({ ViteTsConfigPathsPlugin({
root: '../../', root: '../../',
projects: [join(__dirname, 'tsconfig.json')], projects: ['tsconfig.base.json'],
}), }),
], ],
define: { define: {

View File

@ -375,7 +375,6 @@ export function writeViteConfig(tree: Tree, options: Schema) {
case 'react': case 'react':
viteConfigContent = ` viteConfigContent = `
${options.includeVitest ? '/// <reference types="vitest" />' : ''} ${options.includeVitest ? '/// <reference types="vitest" />' : ''}
import { join } from 'path';
import { defineConfig } from 'vite'; import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react'; import react from '@vitejs/plugin-react';
import ViteTsConfigPathsPlugin from 'vite-tsconfig-paths'; import ViteTsConfigPathsPlugin from 'vite-tsconfig-paths';
@ -385,7 +384,7 @@ ${options.includeVitest ? '/// <reference types="vitest" />' : ''}
react(), react(),
ViteTsConfigPathsPlugin({ ViteTsConfigPathsPlugin({
root: '${offsetFromRoot(projectConfig.root)}', root: '${offsetFromRoot(projectConfig.root)}',
projects: [join(__dirname, 'tsconfig.json')], projects: ['tsconfig.base.json'],
}), }),
], ],
${options.inSourceTests ? defineOption : ''} ${options.inSourceTests ? defineOption : ''}
@ -395,7 +394,6 @@ ${options.includeVitest ? '/// <reference types="vitest" />' : ''}
case 'none': case 'none':
viteConfigContent = ` viteConfigContent = `
${options.includeVitest ? '/// <reference types="vitest" />' : ''} ${options.includeVitest ? '/// <reference types="vitest" />' : ''}
import { join } from 'path';
import { defineConfig } from 'vite'; import { defineConfig } from 'vite';
import ViteTsConfigPathsPlugin from 'vite-tsconfig-paths'; import ViteTsConfigPathsPlugin from 'vite-tsconfig-paths';
@ -403,7 +401,7 @@ ${options.includeVitest ? '/// <reference types="vitest" />' : ''}
plugins: [ plugins: [
ViteTsConfigPathsPlugin({ ViteTsConfigPathsPlugin({
root: '${offsetFromRoot(projectConfig.root)}', root: '${offsetFromRoot(projectConfig.root)}',
projects: [join(__dirname, 'tsconfig.json')], projects: ['tsconfig.base.json'],
}), }),
], ],
${options.inSourceTests ? defineOption : ''} ${options.inSourceTests ? defineOption : ''}