-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: vite.config.js for enhanced flexibility and tool compatibil…
…ity (#10818) Rework the site configuration to avoid returning an asynchronous function, making it easier to override when needed. In addition, add a new `vite.config.js` file to each newly created package. This allows other tools, such as Cypress, to detect Vite’s configurations, which was not possible when using them directly from the `@ui5/webcomponents` package.
- Loading branch information
Showing
3 changed files
with
45 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import viteConfig from "@ui5/webcomponents-tools/components-package/vite.config.js"; //eslint-disable-line | ||
|
||
// Modifying the default Vite configuration provided by the @ui5/webcomponents-tools package. | ||
// You can directly access and update the properties you need to change. | ||
// Ensure that the property exists before modifying it to avoid unintended errors. | ||
// For available configuration options, refer to: https://vite.dev/config/#configuring-vite | ||
// | ||
// Ensure the plugins array exists | ||
// viteConfig.plugins = viteConfig.plugins || []; | ||
// | ||
// Push a new fake plugin | ||
// viteConfig.plugins.push({ name: 'my-custom-plugin' }); | ||
|
||
export default viteConfig; |
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 |
---|---|---|
@@ -1,13 +1,9 @@ | ||
// vite.config.js | ||
import { defineConfig } from 'vite'; | ||
import virtualIndex from '../lib/dev-server/virtual-index-html-plugin.js'; | ||
const virtualIndex = require('../lib/dev-server/virtual-index-html-plugin.js'); | ||
|
||
export default defineConfig(async () => { | ||
const data = await virtualIndex(); | ||
return { | ||
build: { | ||
emptyOutDir: false, | ||
}, | ||
plugins: [data], | ||
} | ||
}) | ||
module.exports = { | ||
build: { | ||
emptyOutDir: false, | ||
}, | ||
plugins: [virtualIndex()], | ||
}; |
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