2024-03-20 11:39:59 +00:00
|
|
|
/* eslint-disable import/no-extraneous-dependencies */
|
|
|
|
import { defineConfig } from 'vite';
|
|
|
|
import react from '@vitejs/plugin-react-swc';
|
|
|
|
import { builtinModules } from 'node:module';
|
|
|
|
import dts from 'vite-plugin-dts';
|
2024-12-02 11:55:37 +01:00
|
|
|
import prism from 'vite-plugin-prismjs';
|
2024-03-20 11:39:59 +00:00
|
|
|
|
|
|
|
import pkg from './package.json';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* TODO: we should have `pack-up` handle this for us, but time constaints
|
|
|
|
* have meant i've fallen back to vite or a fast solution.
|
|
|
|
*
|
|
|
|
* https://strapi-inc.atlassian.net/browse/CONTENT-2341
|
|
|
|
*/
|
|
|
|
export default defineConfig({
|
|
|
|
build: {
|
|
|
|
emptyOutDir: false,
|
|
|
|
target: 'esnext',
|
|
|
|
outDir: 'dist/admin',
|
|
|
|
sourcemap: true,
|
|
|
|
minify: false,
|
|
|
|
lib: {
|
|
|
|
// Could also be a dictionary or array of multiple entry points
|
|
|
|
entry: {
|
|
|
|
index: './admin/src/index.ts',
|
2024-03-28 13:26:44 +00:00
|
|
|
ee: './admin/src/ee.ts',
|
2024-03-20 11:39:59 +00:00
|
|
|
test: './admin/tests/index.ts',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
rollupOptions: {
|
2024-12-02 12:18:24 +01:00
|
|
|
external: ['prism'],
|
2024-03-20 11:39:59 +00:00
|
|
|
output: {
|
|
|
|
interop: 'auto',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
dts({
|
|
|
|
outDir: './dist',
|
|
|
|
tsconfigPath: './admin/tsconfig.build.json',
|
|
|
|
}),
|
|
|
|
react(),
|
2024-12-02 11:55:37 +01:00
|
|
|
prism({
|
|
|
|
languages: ['javascript', 'css', 'html', 'typescript'],
|
|
|
|
plugins: ['line-numbers'],
|
|
|
|
theme: 'okaidia',
|
|
|
|
css: true,
|
|
|
|
}),
|
2024-03-20 11:39:59 +00:00
|
|
|
],
|
|
|
|
});
|