mirror of
https://github.com/sveltejs/svelte.git
synced 2024-11-30 00:46:29 +01:00
60806f74b9
* Push * Remove `rootDir` * Use tsconfig instead of jsconfig * Push recent changes * Better dark mode * empty commit to try and trigger a deploy * bump kit * Fix site-kit dep * Comment out blurb * Update site-kit to 3.2.1 * Externalise sourcemap-codec * Install sourcemap-codec as dep --------- Co-authored-by: Rich Harris <hello@rich-harris.dev>
56 lines
1.5 KiB
JavaScript
56 lines
1.5 KiB
JavaScript
import { sveltekit } from '@sveltejs/kit/vite';
|
|
import * as fs from 'fs';
|
|
import { imagetools } from 'vite-imagetools';
|
|
|
|
process.env.VITE_API_BASE = process.env.DOCS_PREVIEW
|
|
? 'http://localhost:8787'
|
|
: 'https://api.svelte.dev';
|
|
|
|
function raw(ext) {
|
|
return {
|
|
name: 'vite-plugin-raw',
|
|
transform(_, id) {
|
|
if (ext.some((e) => id.endsWith(e))) {
|
|
const buffer = fs.readFileSync(id);
|
|
return { code: `export default ${JSON.stringify(buffer)}`, map: null };
|
|
}
|
|
},
|
|
};
|
|
}
|
|
|
|
/** @type {import('vite').UserConfig} */
|
|
const config = {
|
|
logLevel: 'info',
|
|
plugins: [raw(['.ttf']), imagetools(), sveltekit()],
|
|
optimizeDeps: {
|
|
include: [
|
|
'codemirror',
|
|
'codemirror/mode/javascript/javascript.js',
|
|
'codemirror/mode/handlebars/handlebars.js',
|
|
'codemirror/mode/htmlmixed/htmlmixed.js',
|
|
'codemirror/mode/xml/xml.js',
|
|
'codemirror/mode/css/css.js',
|
|
'codemirror/mode/markdown/markdown.js',
|
|
'codemirror/addon/edit/closebrackets.js',
|
|
'codemirror/addon/edit/closetag.js',
|
|
'codemirror/addon/edit/continuelist.js',
|
|
'codemirror/addon/comment/comment.js',
|
|
'codemirror/addon/fold/foldcode.js',
|
|
'codemirror/addon/fold/foldgutter.js',
|
|
'codemirror/addon/fold/brace-fold.js',
|
|
'codemirror/addon/fold/xml-fold.js',
|
|
'codemirror/addon/fold/indent-fold.js',
|
|
'codemirror/addon/fold/markdown-fold.js',
|
|
'codemirror/addon/fold/comment-fold.js',
|
|
],
|
|
exclude: ['@sveltejs/repl'],
|
|
},
|
|
server: {
|
|
fs: {
|
|
strict: false,
|
|
},
|
|
},
|
|
};
|
|
|
|
export default config;
|