-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow vite/webpack config to be an async function (#23605)
* vite dev server async fn * test projects * update types * simplify setup * fix tests * types * remove junk file * update comments * add more tests * fix system tests
- Loading branch information
1 parent
eb8ae02
commit 4c647f6
Showing
16 changed files
with
808 additions
and
1,491 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
system-tests/project-fixtures/react/cypress-vite-async-function-config.config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { defineConfig } from 'cypress' | ||
import reactPlugin from '@vitejs/plugin-react' | ||
import * as path from 'path' | ||
import * as fs from 'fs' | ||
|
||
module.exports = defineConfig({ | ||
component: { | ||
devServer: { | ||
framework: 'react', | ||
bundler: 'vite', | ||
viteConfig: async () => { | ||
// to be really sure this was called, write a file to the disc with | ||
// the initial config | ||
fs.writeFileSync(path.join(__dirname, 'wrote-to-file'), 'OK') | ||
|
||
// inline vite config via async function | ||
return Promise.resolve({ | ||
plugins: [ | ||
reactPlugin({ | ||
jsxRuntime: 'classic', | ||
}), | ||
], | ||
}) | ||
}, | ||
}, | ||
}, | ||
}) | ||
|
21 changes: 21 additions & 0 deletions
21
system-tests/project-fixtures/react/cypress-webpack-dev-server-async-config.config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { defineConfig } from 'cypress' | ||
import * as path from 'path' | ||
import * as fs from 'fs' | ||
|
||
export default defineConfig({ | ||
component: { | ||
devServer: { | ||
framework: 'react', | ||
bundler: 'webpack', | ||
webpackConfig: async (baseConfig: any) => { | ||
console.log(baseConfig) | ||
fs.writeFileSync(path.join(__dirname, 'wrote-to-file'), 'OK') | ||
const cfg = await import('./webpack.config.js') | ||
return cfg.default | ||
}, | ||
}, | ||
}, | ||
// These tests should run quickly / fail quickly, | ||
// since we intentionally causing error states for testing | ||
defaultCommandTimeout: 1000, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
4c647f6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Circle has built the
linux x64
version of the Test Runner.Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.
Run this command to install the pre-release locally:
4c647f6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Circle has built the
linux arm64
version of the Test Runner.Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.
Run this command to install the pre-release locally:
4c647f6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Circle has built the
darwin arm64
version of the Test Runner.Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.
Run this command to install the pre-release locally:
4c647f6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Circle has built the
darwin x64
version of the Test Runner.Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.
Run this command to install the pre-release locally: