Skip to content

Commit

Permalink
update: add config for asset copying
Browse files Browse the repository at this point in the history
  • Loading branch information
Bilal Meddah authored and bilalesi committed Jan 9, 2024
1 parent 53df589 commit 12728f7
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 1,095 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,9 @@
"util": "^0.12.5",
"vite": "^5.0.10",
"vite-compatible-readable-stream": "^3.6.1",
"vite-plugin-cp": "^4.0.7",
"vite-plugin-dynamic-base": "^1.0.0",
"vite-plugin-dynamic-import": "^1.5.0",
"vite-plugin-favicon2": "^1.1.5",
"vitest": "^1.1.1"
},
"prettier": {
Expand Down
27 changes: 7 additions & 20 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ import svgrPlugin from 'vite-plugin-svgr';
import tsconfigPaths from 'vite-tsconfig-paths';
import commonjs from 'vite-plugin-commonjs';
import viteCompression from 'vite-plugin-compression';
import vitePluginCp from 'vite-plugin-cp';
import 'vite-compatible-readable-stream';
import { ViteFaviconsPlugin } from "vite-plugin-favicon2";

const versionRegex = /^v(\d+\.\d+\.\d+)/;
export default defineConfig(() => {
let commitHash = '', version = '';
if (process.env.VITEST !== 'true') {
Expand All @@ -24,7 +23,6 @@ export default defineConfig(() => {
console.log('⛔️ describe may not getting the latest tag')
}
}
const appVersion = version.match(versionRegex)?.[1] ?? '';

return ({
base: process.env.NODE_ENV === 'production' ? "/__BASE__/" : "/",
Expand All @@ -38,23 +36,11 @@ export default defineConfig(() => {
publicPath: 'window.__BASE__',
transformIndexHtml: true,
}),
ViteFaviconsPlugin({
inject: true,
logo: './public/favicon.svg',
favicons: {
version: appVersion,
appName: 'Nexus Fusion',
appShortName: 'BBP-NF',
appDescription: 'The interface of Blue Brain Nexus, the open-source knowledge graph for data-driven science.',
developerName: 'Blue Brain project',
orientation: 'portrait',
start_url: '/',
icons: {
coast: false,
yandex: false
}
}
}),
vitePluginCp({
targets: [
{ src: 'public/', dest: 'dist/public' },
]
})
],
resolve: {
alias: {
Expand Down Expand Up @@ -93,6 +79,7 @@ export default defineConfig(() => {
emptyOutDir: false,
outDir: 'dist',
assetsDir: 'public',
copyPublicDir: false,
sourcemap: process.env.NODE_ENV !== 'production',
commonjsOptions: {
transformMixedEsModules: true
Expand Down
Loading

0 comments on commit 12728f7

Please sign in to comment.