mirror of
https://github.com/esm7/obsidian-map-view.git
synced 2026-07-22 05:40:27 +00:00
72 lines
2.2 KiB
JavaScript
72 lines
2.2 KiB
JavaScript
import typescript from '@rollup/plugin-typescript';
|
|
import { nodeResolve } from '@rollup/plugin-node-resolve';
|
|
import commonjs from '@rollup/plugin-commonjs';
|
|
import postcss from 'rollup-plugin-postcss';
|
|
import postcss_url from 'postcss-url';
|
|
import copy from 'rollup-plugin-copy';
|
|
import image from '@rollup/plugin-image';
|
|
import svelte from 'rollup-plugin-svelte';
|
|
import analyze from 'rollup-plugin-analyzer';
|
|
import filesize from 'rollup-plugin-filesize';
|
|
// Not using sveltePreprocess anymore, seeming not needed: https://github.com/sveltejs/svelte-preprocess?tab=readme-ov-file#when-to-use-it
|
|
// import { sveltePreprocess } from 'svelte-preprocess';
|
|
|
|
const isProd = process.env.BUILD === 'production';
|
|
|
|
const banner = `/*
|
|
THIS IS A GENERATED/BUNDLED FILE BY ROLLUP
|
|
if you want to view the source visit the plugins github repository
|
|
*/
|
|
`;
|
|
|
|
export default {
|
|
input: 'src/main.ts',
|
|
output: {
|
|
dir: process.env.BUILD === 'development' ? '.' : './dist',
|
|
sourcemap: isProd ? false : 'inline',
|
|
sourcemapExcludeSources: isProd,
|
|
format: 'cjs',
|
|
exports: 'default',
|
|
banner,
|
|
},
|
|
external: [
|
|
'obsidian',
|
|
'@codemirror/view',
|
|
'@codemirror/state',
|
|
'codemirror',
|
|
],
|
|
plugins: [
|
|
image(),
|
|
svelte({
|
|
compilerOptions: {
|
|
css: true,
|
|
},
|
|
}),
|
|
nodeResolve({
|
|
browser: true,
|
|
exportConditions: ['svelte'],
|
|
extensions: ['.mjs', '.js', '.json', '.node', '.ts', '.svelte'],
|
|
}),
|
|
typescript({
|
|
outDir: process.env.BUILD === 'development' ? '.' : './dist',
|
|
}),
|
|
image(),
|
|
commonjs(),
|
|
postcss({
|
|
extensions: ['.css'],
|
|
plugins: [postcss_url({ url: 'inline' })],
|
|
}),
|
|
// analyze({ summaryOnly: true, limit: 20 }), // top 20 modules
|
|
// filesize({ showBrotliSize: true }),
|
|
...(process.env.BUILD !== 'development'
|
|
? [
|
|
copy({
|
|
targets: [
|
|
{ src: './manifest.json', dest: 'dist' },
|
|
{ src: './styles.css', dest: 'dist' },
|
|
],
|
|
}),
|
|
]
|
|
: []),
|
|
],
|
|
};
|