Repository navigation
Expand file tree
/
Copy pathvite.config.dev.js
More file actions
73 lines (65 loc) · 1.71 KB
/
Copy pathvite.config.dev.js
File metadata and controls
73 lines (65 loc) · 1.71 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import { defineConfig } from 'vite'
import path from 'path'
import basicSsl from '@vitejs/plugin-basic-ssl'
/**
* Configuration for developing and building the project.
* The development server uses src/demo as its root.
* Build mode outputs only the library to dev-build.
*/
export default defineConfig(({ command, mode }) => {
// Base configuration
const baseConfig = {
base: './',
mode: 'development',
root: 'src/demo',
cacheDir: path.resolve(__dirname, '.cache/vite'),
plugins: mode === 'e2e' ? [] : [
basicSsl({
name: 'fabric-image-editor',
certDir: 'certs',
}),
]
}
// For the development server (npm run dev)
if (command === 'serve') {
return {
...baseConfig,
server: {
host: '0.0.0.0', // Allow connections from any IP address
port: 5173,
strictPort: true,
allowedHosts: [
'localhost',
'127.0.0.1',
'0.0.0.0',
'www.localhost.com', // For BrowserStack
'.browserstack.com', // All BrowserStack subdomains
'.bs-local.com' // BrowserStack Local
]
}
}
}
// For a build (npm run dev:build)
return {
...baseConfig,
build: {
target: 'es2022',
sourcemap: true,
minify: false,
watch: {},
lib: {
entry: {
main: path.resolve(__dirname, 'src/main.ts')
},
name: 'ImageEditor',
formats: ['es'],
fileName: (format, entryName) => `${entryName}.js`
},
rollupOptions: {
external: ['fabric', 'jspdf', 'jsondiffpatch', 'jsondiffpatch/with-text-diffs']
},
outDir: path.resolve(__dirname, 'dev-build'),
emptyOutDir: true
}
}
})