Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage with Vite.js #16

Open
kien8995 opened this issue Jan 24, 2022 · 2 comments
Open

Usage with Vite.js #16

kien8995 opened this issue Jan 24, 2022 · 2 comments

Comments

@kien8995
Copy link

How i can use DI-compiler with Vite.js ?

@arm1n
Copy link

arm1n commented Jan 4, 2023

I've written a simple vite plugin applying the transformers:

const { di } = require('@wessberg/di-compiler');
const typescript = require('rollup-plugin-ts');

module.exports = function (options = {}) {
  return {
    name: 'vite:di',
    enforce: 'pre',
    ...typescript({
      ...options,
      transformers: [di],
      transpileOnly: true,
      exclude: ['**/*.test.ts'],
      tsconfig: (resolvedConfig) => ({ ...resolvedConfig, declaration: false }),
    }),
  };
};

Adjust options and config to your needs and you should be good to go.

@i7N3
Copy link

i7N3 commented Mar 12, 2023

If someone needs a full setup example, here it is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants