2022-03-26 00:12:00 +03:00
|
|
|
/**
|
|
|
|
* Copyright (c) Microsoft Corporation.
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
import { defineConfig } from 'vite';
|
|
|
|
import react from '@vitejs/plugin-react';
|
2023-02-17 22:19:53 +03:00
|
|
|
// @ts-ignore
|
2022-06-17 02:18:25 +03:00
|
|
|
import { bundle } from './bundle';
|
2022-03-26 00:12:00 +03:00
|
|
|
import * as path from 'path';
|
|
|
|
|
|
|
|
// https://vitejs.dev/config/
|
|
|
|
export default defineConfig({
|
2022-04-05 07:53:19 +03:00
|
|
|
base: '',
|
2022-03-26 00:12:00 +03:00
|
|
|
plugins: [
|
2022-06-17 02:18:25 +03:00
|
|
|
react(),
|
|
|
|
bundle()
|
2022-03-26 00:12:00 +03:00
|
|
|
],
|
|
|
|
resolve: {
|
|
|
|
alias: {
|
2023-02-17 22:19:53 +03:00
|
|
|
'@injected': path.resolve(__dirname, '../playwright-core/src/server/injected'),
|
2023-03-07 05:49:14 +03:00
|
|
|
'@isomorphic': path.resolve(__dirname, '../playwright-core/src/utils/isomorphic'),
|
2022-09-21 04:41:51 +03:00
|
|
|
'@protocol': path.resolve(__dirname, '../protocol/src'),
|
2023-09-09 00:23:35 +03:00
|
|
|
'@testIsomorphic': path.resolve(__dirname, '../playwright/src/isomorphic'),
|
2023-03-02 02:27:23 +03:00
|
|
|
'@trace': path.resolve(__dirname, '../trace/src'),
|
2022-03-26 00:12:00 +03:00
|
|
|
'@web': path.resolve(__dirname, '../web/src'),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
build: {
|
2023-08-20 02:16:44 +03:00
|
|
|
outDir: path.resolve(__dirname, '../playwright-core/lib/vite/traceViewer'),
|
2023-01-13 17:42:56 +03:00
|
|
|
// Output dir is shared with vite.sw.config.ts, clearing it here is racy.
|
|
|
|
emptyOutDir: false,
|
2022-03-26 00:12:00 +03:00
|
|
|
rollupOptions: {
|
2023-01-31 06:07:52 +03:00
|
|
|
input: {
|
|
|
|
index: path.resolve(__dirname, 'index.html'),
|
2023-04-20 04:16:18 +03:00
|
|
|
uiMode: path.resolve(__dirname, 'uiMode.html'),
|
2023-06-21 22:10:50 +03:00
|
|
|
snapshot: path.resolve(__dirname, 'snapshot.html'),
|
2023-01-31 06:07:52 +03:00
|
|
|
},
|
2022-03-26 00:12:00 +03:00
|
|
|
output: {
|
2022-11-02 01:04:30 +03:00
|
|
|
entryFileNames: () => '[name].[hash].js',
|
2022-03-26 00:12:00 +03:00
|
|
|
assetFileNames: () => '[name].[hash][extname]',
|
|
|
|
manualChunks: undefined,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
});
|