cevek / ttypescript

Over TypeScript tool to use custom transformers in the tsconfig.json
1.53k stars 56 forks source link

How to use it in vite? #128

Open yinzixie opened 2 years ago

yinzixie commented 2 years ago

Any extra configuration except changes in tsconfig.json ? Because I got an err said

This module should not be used in runtime. Instead, use a transformer during compilation.

Which means the configuration doesn't work at all.

ctison commented 1 year ago

I found an answer from typia documentation: https://github.com/samchon/typia/wiki/Setup#vite.

In my case I configured vite through this vitest.config.ts:

import typescript from '@rollup/plugin-typescript';
import ttsc from 'ttypescript';
import { defineConfig } from 'vitest/config';

export default defineConfig({
  plugins: [typescript({ typescript: ttsc })],
});