Skip to content

Commit

Permalink
fix: preview throw if .vite not exist
Browse files Browse the repository at this point in the history
close #2223
  • Loading branch information
johnsoncodehk committed Dec 30, 2022
1 parent ec2c3f9 commit 64307ca
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/preview/bin/vite.js
Expand Up @@ -86,7 +86,11 @@ function createViteConfig() {
let proxyConfigContent = readFileSync(path.resolve(__dirname, 'vite', 'config.ts'), { encoding: 'utf8' });
proxyConfigContent = proxyConfigContent.replace('{CONFIG_PATH}', JSON.stringify(path.resolve(workspace, 'vite.config')));

const proxyConfigPath = path.resolve(workspace, 'node_modules', '.vite', 'volar-vite.config.ts');
if (!fs.existsSync(path.resolve(workspace, 'node_modules', '.volar'))) {
fs.mkdirSync(path.resolve(workspace, 'node_modules', '.volar'));
}

const proxyConfigPath = path.resolve(workspace, 'node_modules', '.volar', 'vite.config.ts');
fs.writeFileSync(proxyConfigPath, proxyConfigContent);

process.argv.push('--config', proxyConfigPath);
Expand Down

0 comments on commit 64307ca

Please sign in to comment.