-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
vite.config.js
74 lines (63 loc) · 1.81 KB
/
vite.config.js
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
74
import path from 'path';
import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js';
import license from 'rollup-plugin-license';
import * as pkg from './package.json';
const NODE_ENV = process.argv.mode || 'development';
const VERSION = pkg.version;
/**
* Trick to use Vite server.open option on macOS
* @see https://github.com/facebook/create-react-app/pull/1690#issuecomment-283518768
*/
process.env.BROWSER = 'open';
export default {
build: {
copyPublicDir: false,
lib: {
entry: path.resolve(__dirname, 'src', 'codex.ts'),
name: 'EditorJS',
fileName: 'editorjs',
},
rollupOptions: {
plugins: [
license({
thirdParty: {
allow: {
test: (dependency) => {
// Manually allow html-janitor (https://github.com/guardian/html-janitor/blob/master/LICENSE)
// because of missing LICENSE file in published package
if (dependency.name === 'html-janitor') {
return true;
}
// Return false for unlicensed dependencies.
if (!dependency.license) {
return false;
}
// Allow MIT and Apache-2.0 licenses.
return ['MIT', 'Apache-2.0'].includes(dependency.license);
},
failOnUnlicensed: true,
failOnViolation: true,
},
output: path.resolve(__dirname, 'dist', 'vendor.LICENSE.txt'),
},
}),
],
},
},
define: {
'NODE_ENV': JSON.stringify(NODE_ENV),
'VERSION': JSON.stringify(VERSION),
},
resolve: {
alias: {
'@/types': path.resolve(__dirname, './types'),
},
},
server: {
port: 3303,
open: true,
},
plugins: [
cssInjectedByJsPlugin(),
],
};