generated from yandeu/phaser-project-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.ts
83 lines (73 loc) · 2.8 KB
/
vite.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import { defineConfig } from "vite";
import { VitePluginNode } from "vite-plugin-node";
import { resolve } from "path";
import webpackConfig from "@spaceorbit/client/webpack/webpack.common";
const webpackAliases = webpackConfig.resolve.alias;
const host = process.env.HOST ?? "0.0.0.0";
const port = parseInt(process.env.PORT ?? "") || 3010;
export default defineConfig({
// ...vite configures
server: {
// vite server configs, for details see [vite doc](https://vitejs.dev/config/#server-host)
host,
port,
strictPort: true,
},
resolve: {
alias: {
...webpackAliases,
...{ "~/server": resolve(__dirname, "./src") },
},
},
plugins: [
...VitePluginNode({
// Nodejs native Request adapter
// currently this plugin support 'express', 'nest', 'koa' and 'fastify' out of box,
// you can also pass a function if you are using other frameworks, see Custom Adapter section
adapter: "express",
// tell the plugin where is your project entry
appPath: resolve(__dirname, "./src/core/app.ts"),
// Optional, default: 'viteNodeApp'
// the name of named export of you app from the appPath file
exportName: "serverListener",
// Optional, default: 'esbuild'
// The TypeScript compiler you want to use
// by default this plugin is using vite default ts compiler which is esbuild
// 'swc' compiler is supported to use as well for frameworks
// like Nestjs (esbuild dont support 'emitDecoratorMetadata' yet)
// you need to INSTALL `@swc/core` as dev dependency if you want to use swc
tsCompiler: "esbuild",
// Optional, default: {
// jsc: {
// target: 'es2019',
// parser: {
// syntax: 'typescript',
// decorators: true
// },
// transform: {
// legacyDecorator: true,
// decoratorMetadata: true
// }
// }
// }
// swc configs, see [swc doc](https://swc.rs/docs/configuration/swcrc)
swcOptions: {},
}),
],
optimizeDeps: {
disabled: true,
include: [],
// Vite does not work well with optionnal dependencies,
// you can mark them as ignored for now
// eg: for nestjs, exlude these optional dependencies:
// exclude: [
// '@nestjs/microservices',
// '@nestjs/websockets',
// 'cache-manager',
// 'class-transformer',
// 'class-validator',
// 'fastify-swagger',
// ],
exclude: ["mock-aws-s3", "aws-sdk", "nock", "node-datachannel"],
},
});