editor.js/vite.config.js
Peter Savchenko b39996616c
chore(perf): initialisation and rendering performance optimisations (#2430)
* renderer batching

* initialization and rendering performance optimized

* insertMany api method added

* Update index.html

* rm old method

* upd changelog

* upd paragraph

* paste tests fixed

* api blocks tests fixed

* backspace event tests fixed

* async issues in tests fixed

* eslint

* stub block added, tests added

* eslint

* eslint

* add test for insertMany()

* Update package.json
2023-08-08 22:17:09 +03:00

69 lines
1.7 KiB
JavaScript

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),
},
server: {
port: 3303,
open: true,
},
plugins: [
cssInjectedByJsPlugin(),
],
};