| |
| |
| |
| |
| @@ -1750,6 +1750,18 @@ describe('loadConfigFromFile', () => { |
| expect(await loadWithWarnings('clean')).toHaveLength(0) |
| }) |
| |
| + test('does not warn for an .mts config under a CommonJS package', async () => { |
| + const cwd = process.cwd() |
| + process.chdir(path.resolve(compatRoot, 'mts-config')) |
| + try { |
| + expect( |
| + await loadWithWarnings('mts-config', 'vite.config.mts'), |
| + ).toHaveLength(0) |
| + } finally { |
| + process.chdir(cwd) |
| + } |
| + }) |
| + |
| test('does not warn for a CJS config using __dirname', async () => { |
| expect(await loadWithWarnings('cjs', 'vite.config.cjs')).toHaveLength(0) |
| }) |
| |
| new file mode 100644 |
| |
| |
| |
| @@ -0,0 +1,5 @@ |
| +{ |
| + "name": "@vitejs/test-native-compat-mts", |
| + "type": "commonjs", |
| + "private": true |
| +} |
| |
| new file mode 100644 |
| |
| |
| |
| @@ -0,0 +1,3 @@ |
| +import { defineConfig } from 'vite' |
| + |
| +export default defineConfig({}) |
| |
| |
| |
| |
| @@ -459,6 +459,8 @@ importers: |
| |
| packages/vite/src/node/__tests__/fixtures/config/native-compat/esm-in-commonjs-pkg: {} |
| |
| + packages/vite/src/node/__tests__/fixtures/config/native-compat/mts-config: {} |
| + |
| packages/vite/src/node/__tests__/fixtures/config/native-import: {} |
| |
| packages/vite/src/node/__tests__/fixtures/config/plugin-module-condition: {} |
|
|