-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.mjs
38 lines (36 loc) · 1.46 KB
/
vite.config.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import path from 'path';
import { defineConfig, loadEnv } from 'vite';
import react from '@vitejs/plugin-react';
import webExtension from '@samrum/vite-plugin-web-extension';
import eslint from 'vite-plugin-eslint';
import { getManifest } from './src/manifest';
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '');
return {
plugins: [
// without react() plugin: page always refreshes
react({
include: ['**/*.jsx', '**/*.js'],
}),
eslint(),
webExtension({
manifest: getManifest(Number(env.MANIFEST_VERSION), env.BROWSER_TARGET, env),
// Adds the use_dynamic_url property to web accessible resources generated by the plugin.
// In Firefox Manifest 3 (experimantel): Set to false
// (default: true)
useDynamicUrlWebAccessibleResources: false,
// In Manifest V3, merge web accessible resource definitions that have matching non-resource properties and dedupe and sort resources.
// In Manifest V2, sort web accessible resources.
// (default: true)
optimizeWebAccessibleResources: true,
}),
],
resolve: {
alias: {
'~': path.resolve(__dirname, './src'),
'@': path.resolve(__dirname, './'),
},
},
};
});