Skip to content

Commit

Permalink
Update vite js path resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
nuckle committed Sep 25, 2024
1 parent 8df86c2 commit 0e7e3bb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/sass/base/config.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ $gutter: $grid-gutter-width;
@use 'sass:meta';

:root[color-mode='light'] {
@include meta.load-css('../../../node_modules/highlight.js/styles/atom-one-light');
@include meta.load-css('~highlight.js/styles/atom-one-light');
}
:root[color-mode='dark'] {
@include meta.load-css('../../../node_modules/highlight.js/styles/atom-one-dark');
@include meta.load-css('~highlight.js/styles/atom-one-dark');
}

// FONTS LOAD SECTION
Expand Down
15 changes: 14 additions & 1 deletion vite.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineConfig } from 'vite';
import { resolve, relative, extname } from 'path';
import { resolve, relative, extname, join } from 'path';
import { fileURLToPath } from 'url';
import { VitePWA } from 'vite-plugin-pwa';
import glob from 'fast-glob';
Expand All @@ -21,6 +21,19 @@ export default defineConfig({
],
},
},
resolve: {
alias: [
{
find: /~(.+)/,
replacement: join(process.cwd(), 'node_modules/$1'),
},

{
find: /@\//,
replacement: join(process.cwd(), './src/renderer') + '/',
},
],
},
plugins: [
viteSvgSpriteWrapper({
icons: './src/img/svg/*.svg',
Expand Down

0 comments on commit 0e7e3bb

Please sign in to comment.