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(),
ViteTsConfigPathsPlugin({
root: '../../',
projects: ['./tsconfig.json'],
projects: ['tsconfig.base.json'],
}),
],
});
@ -213,7 +213,7 @@ export default mergeConfig(baseConfig, {
react(),
ViteTsConfigPathsPlugin({
root: '../../',
projects: ['./tsconfig.json'],
projects: ['tsconfig.base.json'],
}),
],
});

View File

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

View File

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

View File

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