Fixed debug step by step in dev mode

This commit is contained in:
mige 2025-08-26 16:11:42 +04:00
parent 617391ce2c
commit e2371242a8
2 changed files with 6 additions and 6 deletions

View File

@ -33,7 +33,7 @@ export default function forceTerserPlugin({ filePath }) {
if (result.code && result.map) { if (result.code && result.map) {
await Promise.all([ await Promise.all([
writeFile(filePath, result.code, 'utf-8'), writeFile(filePath, result.code, 'utf-8'),
writeFile(mapPath, result.map, 'utf-8'), writeFile(mapPath, result.map, 'utf-8'),
]); ]);
console.log(`${fileName} and ${mapFileName} regenerated with Terser`); console.log(`${fileName} and ${mapFileName} regenerated with Terser`);
} else { } else {

View File

@ -7,6 +7,7 @@ import glsl from 'vite-plugin-glsl';
const __filename = fileURLToPath(import.meta.url); const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename); const __dirname = path.dirname(__filename);
/** /**
* @param {{ mode: 'development' | 'production' }} param0 * @param {{ mode: 'development' | 'production' }} param0
* @returns {import('vite').UserConfig} * @returns {import('vite').UserConfig}
@ -31,10 +32,9 @@ export default function ({mode}: { mode: 'development' | 'production' }) {
output: { output: {
entryFileNames: `og.[format].js`, entryFileNames: `og.[format].js`,
assetFileNames: `[name][extname]`, assetFileNames: `[name][extname]`,
sourcemapExcludeSources: true, sourcemapExcludeSources: !isDev,
}, },
plugins: [ plugins: !isDev ? [
// doesn't work for esm modules
terser({ terser({
compress: true, compress: true,
mangle: true, mangle: true,
@ -42,12 +42,12 @@ export default function ({mode}: { mode: 'development' | 'production' }) {
comments: false comments: false
} }
}) })
] ] : [] // important no plugins for development mode
} }
}, },
plugins: [ plugins: [
glsl({ glsl({
include: [ // Glob pattern, or array of glob patterns to import include: [
'**/*.glsl', '**/*.wgsl', '**/*.glsl', '**/*.wgsl',
'**/*.vert', '**/*.frag', '**/*.vert', '**/*.frag',
'**/*.vs', '**/*.fs' '**/*.vs', '**/*.fs'