Git Product home page Git Product logo

vite-plugin-node's Introduction

npm package node compatibility

Vite Plugin Node

A vite plugin to allow you to use vite as node dev server.

Features

  • All the perks from Vite plus:
  • Node server HMR! (hot module replacement)
  • Support Express, Fastify, Koa and Nest out of the box
  • Support Custom Request Adapter
  • You can choose to use esbuild or swc to compile your typescript files

Get started


  1. Install vite and this plugin with your favorite package manager, here use npm as example:

    npm install vite vite-plugin-node -D
  2. Create a vite.config.ts file in your project root to config vite to actually use this plugin:

    import { defineConfig } from 'vite';
    import { VitePluginNode } from 'vite-plugin-node';
    
    export default defineConfig({
      // ...vite configures
      server: {
        // vite server configs, for details see [vite doc](https://vitejs.dev/config/#server-host)
        port: 3000
      },
      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: './app.ts',
    
          // Optional, default: 'viteNodeApp'
          // the name of named export of you app from the appPath file
          exportName: 'viteNodeApp',
    
          // Optional, default: false
          // if you want to init your app on boot, set this to true
          initAppOnBoot: false,
    
          // 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: {
        // 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',
        // ],
      },
    });
  3. Update your server entry to export your app named viteNodeApp or the name you configured.

const app = express();

// your beautiful code...

if (import.meta.env.PROD)
  app.listen(3000);

export const viteNodeApp = app;

More Examples:

  1. Add a npm script to run the dev server:

    "scripts": {
      "dev": "vite"
    },
  2. Run the script! npm run dev

Custom Adapter

If your favorite framework not supported yet, you can either create an issue to request it or use the adapter option to tell the plugin how to pass down the request to your app. You can take a look how the supported frameworks implementations from the ./src/server folder. Example:

import { defineConfig } from 'vite';
import { VitePluginNode } from 'vite-plugin-node';

export default defineConfig({
  plugins: [
    ...VitePluginNode({
      adapter({ app, server, req, res, next }) {
        app(res, res);
      },
      appPath: './app.ts'
    })
  ]
});

Build

This plugin leverages Vite SSR mode to build your app. All you need to do is add a build script to your package.json:

"scripts": {
  "build": "vite build"
},

For more build config please check vite doc

Note: By default, starting from vite v3, the ssr buildle will be in esm format. if you want to build cjs, add ssr: { format: 'cjs' } to your vite config.

Examples

See the examples folder.

Why?


While frontend development tooling is evolving rapidly in recent years, backend DX is still like in stone age. No hot module replacement; Typescript recompiling slow as funk; Lack of plugin system etc. Thanks to Vite.js created by Evan You (A.K.A creator of vue.js; my biggest idol developer), makes all those dreams for backend development come true!

How?


Vite by design has a middleware mode, which allows us to use it programmatically inside other modules. It's originally made for SSR, so that for each request, vite can load the renderer and render the latest changes you made to your app (https://vitejs.dev/guide/ssr.html). This plugin leverages this feature to load and execute your server app entry.

You may ask, isn't super slow, since it re-compiles/reloads the entire app? The answer is NO, because vite is smart. It has a builtin module graph as a cache layer, the graph is built up the first time your app loads. After that, when you update a file, vite will only invalidate that one and its parent modules, so that for next request, only those invalidated modules need to be re-compiled which is super fast thanks to esbuild or swc.

To-Do

As this plugin just fresh developed, there are still lots ideas need to be implemented, including:

  • Test with a large node project, I need y'all helps on this!
  • Unit tests

Bugs

Please create an issue if you found any bugs, to help me improve this project!

vite-plugin-node's People

Contributors

axe-me avatar cyburstud avatar enricosecondulfofides avatar hisham-otofacts avatar imranbarbhuiya avatar n0texisting avatar rdil avatar spa5k avatar wighawag avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vite-plugin-node's Issues

Request for example working with Docker/docker-compose

Have vite starting locally using the express example, but running into an error when doing it inside the container:

app_1        | failed to load config from /home/myproj/vite.config.ts
app_1        | error when starting dev server:
app_1        | Error: The service was stopped
app_1        |     at /home/myproj/node_modules/esbuild/lib/main.js:1217:25
app_1        |     at /home/myproj/node_modules/esbuild/lib/main.js:609:9
app_1        |     at Socket.afterClose (/home/myproj/node_modules/esbuild/lib/main.js:587:7)
app_1        |     at Socket.emit (node:events:406:35)
app_1        |     at Socket.emit (node:domain:475:12)
app_1        |     at endReadableNT (node:internal/streams/readable:1343:12)
app_1        |     at processTicksAndRejections (node:internal/process/task_queues:83:21)

import.meta.hot.dispose not working?

It seems disposing of side effects does not work. If I have some background task running (job scheduler, db watcher, etc.) in my server, I usually gracefully clean it up on shutdown by listening for signals.

In order for this to work in HMR, my understanding is that I need to register a dispose callback in the file with the side effect. E.g.:

const handle = setInterval(() => {
  console.log('ping');
}, 1000);

if (import.meta.hot) {
  import.meta.hot.accept();
  import.meta.hot.dispose(() => {
    console.log('dispose');
    clearInterval(handle);
  });
}

However, the callback is never called, so I'll have two intervals printing pings.

Reproduction:
https://stackblitz.com/edit/node-qfyzmw?file=index.ts,fileWithSideEffect.ts
Change e.g. 'ping' -> 'ping1'
Reload right side

Node12 support

hi! thanks for creating this plugin -- is there anything preventing setting the min engine for node to 12? it didn't seem like there was anything egregious. unfortunately, i don't have control over the node version we use in our environment.

thanks!
ethan

[ERROR] HMR not working

Followed the guide 100%. for Express.

Executed npm run dev.

Server started successfully.

Made a change in the code.

Browser content didn't change.

Hit F5 on browser to refresh the content.

Error: listen EADDRINUSE: address already in use :::3000

Does not work with @nestjs/graphql

Reproduction:
https://github.com/stevefan1999-personal/vite-plugin-node/tree/repo-graphql-failure/examples/nest

Log:

> [email protected] dev
> vite


  vite v2.9.14 dev server running at:

  > Local: http://localhost:3000/
  > Network: use `--host` to expose

  ready in 238ms.

reflect-metadata doesn't appear to be written in CJS, but also doesn't appear to be a valid ES module (i.e. it doesn't have "type": "module" or an .mjs extension for the entry point). Please contact the package author to fix.
[Nest] 23764  - 11/07/2022, 1:10:41 am     LOG [NestFactory] Starting Nest application...
[Nest] 23764  - 11/07/2022, 1:10:41 am     LOG [InstanceLoader] TypeOrmModule dependencies initialized +115ms
[Nest] 23764  - 11/07/2022, 1:10:41 am     LOG [InstanceLoader] AppModule dependencies initialized +1ms
[Nest] 23764  - 11/07/2022, 1:10:41 am     LOG [InstanceLoader] GraphQLSchemaBuilderModule dependencies initialized +1ms
[Nest] 23764  - 11/07/2022, 1:10:41 am     LOG [InstanceLoader] GraphQLModule dependencies initialized +1ms
[Nest] 23764  - 11/07/2022, 1:10:41 am     LOG [InstanceLoader] TypeOrmCoreModule dependencies initialized +22ms
[Nest] 23764  - 11/07/2022, 1:10:41 am     LOG [InstanceLoader] TypeOrmModule dependencies initialized +1ms
[Nest] 23764  - 11/07/2022, 1:10:41 am     LOG [InstanceLoader] UsersModule dependencies initialized +1ms
[Nest] 23764  - 11/07/2022, 1:10:41 am     LOG [RoutesResolver] AppController {/}: +5ms
[Nest] 23764  - 11/07/2022, 1:10:41 am     LOG [RouterExplorer] Mapped {/, GET} route +3ms
[Nest] 23764  - 11/07/2022, 1:10:41 am     LOG [RouterExplorer] Mapped {/random, GET} route +1ms
[Nest] 23764  - 11/07/2022, 1:10:41 am     LOG [RoutesResolver] UsersController {/}: +0ms
[Nest] 23764  - 11/07/2022, 1:10:41 am     LOG [RouterExplorer] Mapped {/all, GET} route +1ms
[Nest] 23764  - 11/07/2022, 1:10:41 am     LOG [RouterExplorer] Mapped {/add-random, GET} route +1ms
[Nest] 23764  - 11/07/2022, 1:10:41 am     LOG [RouterExplorer] Mapped {/id/:id, GET} route +1ms
[Nest] 23764  - 11/07/2022, 1:10:42 am     LOG [GraphQLModule] Mapped {/graphql, POST} route +120ms
[Nest] 23764  - 11/07/2022, 1:10:42 am     LOG [NestApplication] Nest application successfully started +4ms
[Nest] 23764  - 11/07/2022, 1:10:43 am     LOG [RoutesResolver] AppController {/}: +1595ms
[Nest] 23764  - 11/07/2022, 1:10:43 am     LOG [RouterExplorer] Mapped {/, GET} route +1ms
[Nest] 23764  - 11/07/2022, 1:10:43 am     LOG [RouterExplorer] Mapped {/random, GET} route +0ms
[Nest] 23764  - 11/07/2022, 1:10:43 am     LOG [RoutesResolver] UsersController {/}: +1ms
[Nest] 23764  - 11/07/2022, 1:10:43 am     LOG [RouterExplorer] Mapped {/all, GET} route +0ms
[Nest] 23764  - 11/07/2022, 1:10:43 am     LOG [RouterExplorer] Mapped {/add-random, GET} route +1ms
[Nest] 23764  - 11/07/2022, 1:10:43 am     LOG [RouterExplorer] Mapped {/id/:id, GET} route +0ms
C:\Users\steve\node\vite-plugin-node\examples\nest\node_modules\graphql\type\schema.js:219
        throw new Error(
              ^

Error: Schema must contain uniquely named types but contains multiple types named "User".
    at new GraphQLSchema (C:\Users\steve\node\vite-plugin-node\examples\nest\node_modules\graphql\type\schema.js:219:15)
    at GraphQLSchemaFactory.create (C:\Users\steve\node\vite-plugin-node\examples\nest\node_modules\@nestjs\graphql\dist\schema-builder\graphql-schema.factory.js:40:24)
    at GraphQLSchemaBuilder.generateSchema (C:\Users\steve\node\vite-plugin-node\examples\nest\node_modules\@nestjs\graphql\dist\graphql-schema.builder.js:36:52)
    at GraphQLSchemaBuilder.build (C:\Users\steve\node\vite-plugin-node\examples\nest\node_modules\@nestjs\graphql\dist\graphql-schema.builder.js:23:31)
    at GraphQLFactory.mergeWithSchema (C:\Users\steve\node\vite-plugin-node\examples\nest\node_modules\@nestjs\graphql\dist\graphql.factory.js:29:69)
    at ApolloDriver.start (C:\Users\steve\node\vite-plugin-node\examples\nest\node_modules\@nestjs\apollo\dist\drivers\apollo.driver.js:19:51)
    at GraphQLModule.onModuleInit (C:\Users\steve\node\vite-plugin-node\examples\nest\node_modules\@nestjs\graphql\dist\graphql.module.js:104:36)
    at async callModuleInitHook (C:\Users\steve\node\vite-plugin-node\examples\nest\node_modules\@nestjs\core\hooks\on-module-init.hook.js:51:9)
    at async NestApplication.callInitHook (C:\Users\steve\node\vite-plugin-node\examples\nest\node_modules\@nestjs\core\nest-application-context.js:178:13)
    at async NestApplication.init (C:\Users\steve\node\vite-plugin-node\examples\nest\node_modules\@nestjs\core\nest-application.js:96:9)

It seems like we have duplicated instances of User class that has different resolution each time

Probably related: #50

Can't access my .env file value in app.ts

// vite.config.ts
// ...
import { config } from 'dotenv';
config(...)

I can't get env by process.env.MY_VALUE in 'app.ts', but i can get it by JSON.parse(JSON.stringify(process.env)).MY_VALUE

I don't know if it's normal but I think at least it's wired.

Use vite-plugin-node along with @vitejs/plugin-react

Apologies if this is a noob level question. I'm new to both vite and vite-node. I want to build an app with both a backend and a front end. As I understand vite enables you to do the front end part easily but without the backend hmr which this plugin is built for.

However I haven't figured out how to combine both with independent server and client directories each hosting it's own set of files, with the server/index.ts having its own /api end points and falling back to client for the remaining * routes. I've gone through the examples here but couldn't find what I was looking for.

Any help would be appreciated, thanks!

NestJS + TypeORM support

This plugin looks great and I've been trying to get it going on a NestJS app, but have run into an issue that I think is caused by the fact that TypeORM requires all the entities it's told about via its config, which gives the error.

SyntaxError: Cannot use import statement outside a module

on the first line of the *.entity.ts file.

Looks like this is the line in TypeORM that does the require:
https://github.com/typeorm/typeorm/blob/master/src/util/DirectoryExportedClassesLoader.ts#L41

Is there some way to make this plugin work with NestJS and TypeORM? I found this issue on the TypeORM repo that seems potentially relevant, but states that ESM isn't supported.

I played around with running under ts-node and changing the require() to import(), but didn't really get anywhere with it as yet.

Using this as part of a full stack dev server

Can I use this repo to run a full-stack dev server with vite?

I want to use this in conjunction with the react vite plugin and get it to server react from the root, and the express results from /api

Is there a way to config this to do that?

can this be mixed into a vite app as api mock server?

It seems that the plugin is aimed to backend app development. how about and how to mixed it into a vite app as api mock server? It will perfect for someone who want to rule the frontend and backend at the same time.

Configuring this package in a NestJS Monorepo

I am running a NestJS monorepo using Nest CLI. I have multiple nest apps in this monorepo, and a shared library at the top level. I am unsure how to configure this package for such a setup.

  1. Do I put a vite.config.ts in each app?
  2. Can I run the apps with vite using Nest CLI? e.g nest start app1
  3. How do I get a shared lib to work?

An example of using nestJS monorepo would be very much appreciated!

Express: SSE not working

Using the following code, the connection can be opened, but no data gets sended:

app.get('/stream', (req, res) => {
    res.setHeader('Cache-Control', 'no-cache');
    res.setHeader('Content-Type', 'text/event-stream');
    res.setHeader('Connection', 'keep-alive');
    res.flushHeaders();
    
    res.write("data: Hello World!\n\n");
})

With res.end() I am able to close to connection and send all messages at once.
This issue could also be related to #22.

Websockets do not work

Using the following code, I cannot establish websocket connections:

import Fastify from "fastify";
import wsPlugin from "fastify-websocket";

export const server = Fastify();
server.register(wsPlugin);
server.get("/", { websocket: true }, (ws, req) => {
	console.log(req);
	ws.socket.on("message", (msg) => {
		console.log(msg.toString());
		ws.socket.send("hi from server");
	});
});

if (process.env.NODE_ENV === "production") {
	server.listen(3000);
}

If I run the server directly, it works fine.

vite.config.ts:

import { defineConfig } from "vite";
import { VitePluginNode } from "vite-plugin-node";
export default defineConfig({
	server: {
		port: 3000,
	},
	plugins: [
		...VitePluginNode({
			adapter: "fastify",
			appPath: "./src/server.ts",
			exportName: "server",
			tsCompiler: "esbuild",
		}),
	],
});

Error when evaluating SSR module (mongoose dependency)

Reproduction steps

  1. git clone https://github.com/a-ski/vite-node.git
  2. yarn install
  3. yarn dev
  4. curl localhost:3000

Error

18:44:51 [vite] Error when evaluating SSR module ./src/index.ts:
Error: Cannot find module 'mongodb-extjson' imported from 'MY_FS_PATH\vite-node\node_modules\mongodb\lib\core\utils.js'
at viteResolve (MY_FS_PATH\vite-node\node_modules\vite\dist\node\chunks\dep-9c153816.js:56216:25)
at Function. (MY_FS_PATH\vite-node\node_modules\vite\dist\node\chunks\dep-9c153816.js:56233:28)
at Function.Module._load (internal/modules/cjs/loader.js:747:27)
at Module.require (internal/modules/cjs/loader.js:974:19)
at Object.require (internal/modules/cjs/helpers.js:88:18)
at _optionalRequire (MY_FS_PATH\vite-node\node_modules\mongodb\node_modules\optional-require\dist\index.js:83:65)
at x (MY_FS_PATH\vite-node\node_modules\mongodb\node_modules\optional-require\dist\index.js:144:16)
at Object.retrieveEJSON (MY_FS_PATH\vite-node\node_modules\mongodb\lib\core\utils.js:50:15)
at Object. (MY_FS_PATH\vite-node\node_modules\mongodb\lib\core\index.js:5:34)
at Module._compile (internal/modules/cjs/loader.js:1085:30)

Questions

  1. How to disable SSR if I don't use it at all?
  2. Why does it try resolve nested dependencies, which btw are optional in the mongodb package?
  3. How can I prevent it from happening?

[0.0.18] Cannot find module '@swc/core'

This is the output when running vite dev.
Builds work fine

downgrading to 0.0.17 fixes the issue

failed to load config from /home/jipaix/Dev/mg/vite.config.js
error when starting dev server:
Error: Cannot find module '@swc/core'
Require stack:
- /home/jipaix/Dev/mg/node_modules/vite-plugin-node/dist/rollup-plugin-swc.js
- /home/jipaix/Dev/mg/node_modules/vite-plugin-node/dist/index.js
- /home/jipaix/Dev/mg/vite.config.js
- /home/jipaix/.nvm/versions/node/v16.14.0/lib/node_modules/vite/dist/node/chunks/dep-9c153816.js
- /home/jipaix/.nvm/versions/node/v16.14.0/lib/node_modules/vite/dist/node/cli.js
- /home/jipaix/.nvm/versions/node/v16.14.0/lib/node_modules/vite/bin/vite.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/home/jipaix/Dev/mg/node_modules/vite-plugin-node/dist/rollup-plugin-swc.js:5:16)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
    at Object.require.extensions.<computed> [as .js] (/home/jipaix/.nvm/versions/node/v16.14.0/lib/node_modules/vite/dist/node/chunks/dep-9c153816.js:71419:13)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)

Using top level await: Module format cjs does not support top-level await. Use the "es" or "system" output formats rather.

I want to use top level await in my server. When I do so, I get the following error message:

Module format cjs does not support top-level await. Use the "es" or "system" output formats rather.

So I tried build: { target: "esnext" }, but it didn't help.

I also tried

lib: {
    entry: "./source/app.js",
    formats: ["es"],
},

This works, but then the outputed file still contains imports for the dependency and did not bundle everything in one file

Screen Shot 2022-06-03 at 01 40 10

Do I have to set another option for this to work? Or do I have to use a plugin like vite-plugin-top-level-await for that? I think vite-nodesays that they support top level wait out of the box, could this also be done in this package?

This is my vite.config:

import path from "path";
import * as vite from "vite";
import mkcertVitePlugin from "vite-plugin-mkcert";
import { VitePluginNode as nodeVitePlugin } from "vite-plugin-node";

const viteConfig = vite.defineConfig({
    resolve: {
        alias: [
            {
                find: "@",
                replacement: path.resolve("source"),
            },
        ],
    },
    build: { target: "esnext" },
    plugins: [
        mkcertVitePlugin(),
        ...nodeVitePlugin({
            adapter: "koa",
            appPath: "./source/app.js",
            exportName: "app",
        }),
    ],
    server: {
        https: { maxSessionMemory: 100 },
        host: "0.0.0.0",
        port: 4000,
    },
});

Limitation to develop koa2 project

Some limitation when I use this plugin to develop koa2 project.

  • This plugin seems treat koa2 project as a vite server middleware. It seems hard to run some init scripts before start app.
import Koa from 'koa';
import compose from 'koa-compose';
import middlewares from '@/middlewares';
import initScript from '@/scripts/init';

// run some init scripts
// never execute before the first request come
initScript();

const app = new Koa();

app.use(compose(middlewares as any));

if (process.env.NODE_ENV === 'production') {
  app.listen(3000);
}

export const viteNodeApp = app;
  • I have no idea of how to debug my project with vscode.

Vite build support?

Would be great, especially for Docker deployment, to be able to do something like vite build where it uses rollup to deliver a tree shaken version of your node server to reduce build size and runtime ts compilation. While the runtime compiling is fast its also adding extra watcher and stuff that shouldn't be on in production.

Multiple entry points

Any chance to build multiple node applications within one repository? With WebPack I had serveral entrypoints for my command scripts.

NestApplication reloading after each GET request

[this part is due to me forgetting if (import.meta.env.PROD) around the bootstrap function]
to jump to the issue

image

As you can see I get all the init messages twice 🤔.

here is the vite.config.ts

import { defineConfig } from 'vite';
import { VitePluginNode } from 'vite-plugin-node';

// eslint-disable-next-line import/no-default-export
export default defineConfig({
  server: {
    port: 3000
  },
  plugins: [
    ...VitePluginNode({
      appName: 'stargraph-api',
      adapter: 'nest',
      appPath: './src/main.ts',
      exportName: 'viteNodeApp',
      tsCompiler: 'swc'
    })
  ],
  optimizeDeps: {
    exclude: [
      '@nestjs/microservices',
      '@nestjs/websockets',
      'cache-manager',
      'class-transformer',
      'class-validator',
      'fastify-swagger'
    ]
  }
});

and my main.ts

import { NestFactory } from '@nestjs/core';
import { DocumentBuilder, SwaggerCustomOptions, SwaggerModule } from '@nestjs/swagger';

import { ApiModule } from './api.module';

(async () => {
  const app = await NestFactory.create(ApiModule);

  const config = new DocumentBuilder()
    .setTitle('Cats example')
    .setDescription('The cats API description')
    .setVersion('1.0')
    .addTag('cats')
    .build();

  const swaggerCustomOptions: SwaggerCustomOptions = {};

  const document = SwaggerModule.createDocument(app, config);
  SwaggerModule.setup('api', app, document, swaggerCustomOptions);

  await app.listen(3000);
})();

export const viteNodeApp = NestFactory.create(ApiModule); // this returns a Promise, which is ok, this plugin can handle it

The rest of the application is the auto generated one

And those are the versions of the packages I used :

    "@nestjs/common": "^8.4.7",
    "@nestjs/core": "^8.4.7",
    "@nestjs/microservices": "^8.4.7",
    "@nestjs/platform-express": "^8.4.7",
    "@nestjs/swagger": "^5.2.1",

    "@swc/core": "^1.2.207",
    "typescript": "^4.7.4",
    "vite": "^2.9.13",
    "vite-plugin-node": "^1.0.0"

Thanks for that awesome plugin, hope I gave enough infos for you to debug ^^

Runtime log are not displayed by vite

Hello!

I am testing your plugin and I want to have a watch server that restart for each modification. For doing this, I use nodemon.

nodemon -e ts --exec vite

The watch mode seems to work correctly but my console is filled by vite.

vite v2.8.6 dev server running at:

  > Local: http://localhost:3000/
  > Network: use `--host` to expose

  ready in 134ms.

Could you know how to display logs or simple console.log ?

Thank you :)

with graphql + nestjs, vite seems to be adding to the schema on every request causing "Schema must contain uniquely named types" -- repository provided

Related SO thread: https://stackoverflow.com/questions/73284703

I've been trying to get this combination working for a while and fiddled with versions & compatibilities issue until I've hit this brick wall.

I've created a minium repository where the issue is reproducible: https://github.com/sebastiangug/nest-graphql-vite

The graphql configuration:

        const config: ApolloDriverConfig = {
          debug: true,
          playground: true,
          autoSchemaFile: 'schema.gql',
          sortSchema: true,
          path: join(process.cwd(), 'src/graphql.ts'),
          cors: {
            origin: ['*'],
          },
        };

Versions:

  "dependencies": {
    "@nestjs/common": "9.0.8",
    "@nestjs/core": "9.0.8",
    "@nestjs/platform-express": "9.0.8",
    "@nestjs/graphql": "10.0.9",
    "@nestjs/apollo": "10.0.9",
    "graphql": "15.8.0",
    "apollo-server-express": "3.6.7",
    "reflect-metadata": "0.1.13",
    "rimraf": "3.0.2",
    "rxjs": "7.5.5"
  },
  "devDependencies": {
    "@nestjs/cli": "8.2.8",
    "@nestjs/schematics": "8.0.11",
    "@types/express": "4.17.13",
    "@types/node": "16.0.0",
    "@types/supertest": "2.0.12",
    "prettier": "2.7.1",
    "source-map-support": "0.5.21",
    "ts-node": "10.8.1",
    "tsconfig-paths": "3.10.1",
    "typescript": "4.7.4",
    "vite-plugin-node": "1.0.0",
    "vite": "2.9.13",
    "@swc/core": "1.2.207",
    "vite-tsconfig-paths": "3.5.0"
  }

on nodejs 16

Vite config:

import { ConfigEnv, defineConfig } from 'vite';
import { VitePluginNode } from 'vite-plugin-node';
import tsconfigPaths from 'vite-tsconfig-paths';

export default defineConfig(({ command, mode }: ConfigEnv) => {
  return {
    build: {
      target: 'es2020',
    },
    define: {
      'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
    },
    server: {
      port: 3100,
    },
    optimizeDeps: {
      exclude: [
        '@nestjs/platform-socket.io',
        '@nestjs/express',
        '@nestjs/websockets',
        '@nestjs/microservices',
        '@nestjs/graphql',
        '@nestjs/apollo',
        '@nestjs/core',
        'cache-manager',
        'class-transformer',
        'class-validator',
        'graphql',
      ],
    },
    plugins: [
      tsconfigPaths(),
      ...VitePluginNode({
        adapter: 'nest',
        appPath: './src/main.ts',
        tsCompiler: 'swc',
        swcOptions: {
          jsc: {
            parser: {
              decorators: true,
              syntax: 'typescript',
              dynamicImport: true,
            },
            transform: {
              decoratorMetadata: true,
            },
          },
        },
        appName: 'graphql-server',
      }),
    ],
  };
});

[ERROR] Error That Doesn't Affect Compilation

After running npm run dev which runs vite, I'm receiving an error that doesn't affect compilation, but I would like to get rid of it.

image

After the error, everything runs perfectly:

image

package.json:

"dependencies": {
    "@nestjs/common": "^8.0.0",
    "@nestjs/core": "^8.0.0",
    "@nestjs/platform-express": "^8.0.0",
    "@prisma/client": "^3.13.0",
    "@swc/core": "^1.2.181",
    "reflect-metadata": "^0.1.13",
    "rimraf": "^3.0.2",
    "rxjs": "^7.2.0"
  },
  "devDependencies": {
    "@nestjs/cli": "^8.0.0",
    "@nestjs/schematics": "^8.0.0",
    "@nestjs/testing": "^8.0.0",
    "@types/express": "^4.17.13",
    "@types/jest": "27.5.0",
    "@types/node": "^16.0.0",
    "@types/supertest": "^2.0.11",
    "@typescript-eslint/eslint-plugin": "^5.0.0",
    "@typescript-eslint/parser": "^5.0.0",
    "eslint": "^8.0.1",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-prettier": "^4.0.0",
    "jest": "28.0.3",
    "prettier": "^2.3.2",
    "prisma": "^3.13.0",
    "source-map-support": "^0.5.20",
    "supertest": "^6.1.3",
    "ts-jest": "28.0.1",
    "ts-loader": "^9.2.3",
    "ts-node": "^10.0.0",
    "tsconfig-paths": "4.0.0",
    "typescript": "^4.3.5",
    "vite": "^2.9.8",
    "vite-plugin-node": "0.0.19"
  }

tsconfig.json:

{
  "compilerOptions": {
    "module": "ESNext",
    "declaration": true,
    "removeComments": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "allowSyntheticDefaultImports": true,
    "target": "ESNext",
    "sourceMap": true,
    "outDir": "./dist",
    "baseUrl": "./",
    "incremental": true,
    "skipLibCheck": true,
    "strictNullChecks": false,
    "noImplicitAny": false,
    "strictBindCallApply": false,
    "forceConsistentCasingInFileNames": false,
    "noFallthroughCasesInSwitch": false,
    "moduleResolution": "node",
    
  }
}

vite.config.ts:

import { defineConfig } from 'vite';
import { VitePluginNode } from 'vite-plugin-node';

export default defineConfig({
  server: {
    open: true
  },
  plugins: [
    ...VitePluginNode({
      adapter: 'nest',
      appPath: './src/main.ts',
      tsCompiler: 'swc',
    }),
  ],
});

Thanks.

peerDependency @swc/core isn't optional

import { join } from 'path';
import { defineConfig } from 'vite';
import { VitePluginNode } from 'vite-plugin-node';

export default defineConfig({
  server: {
    port: 3000,
  },
   plugins: [
    ...VitePluginNode({
      adapter: 'express',
      appPath: './index.ts',
      exportName: 'viteNodeApp',
      tsCompiler: 'esbuild',
      swcOptions: {},
    }),
  ],
});
error during build:
Error: Cannot find module '@swc/core'

could you temporarily fix it by changing this line until it's fixed?

"optional": true

Running vite: Cannot modify fastify route without crashing.

Running "vite" as my pnpm dev command. Happens when I edit a route handler.

6:50:39 AM [vite] Error when evaluating SSR module ./src/index.ts:
Error: Cannot add route when fastify instance is already started!

Seems like fastify has issues with SSR. My old command "nodemon" works fine since it reloads the whole server from scratch.

emitDecoratorMetadata workaround

First of all thank you for this wonderful package, the speed difference is insane.
It almost complied for me, until this error occured

UnhandledPromiseRejectionWarning: TypeError: Cannot read property '1' of undefined
    at extractTypeIfArray (/home/yaslix/projects/vp/node_modules/@nestjs/graphql/dist/utils/reflection.utilts.js:32:29)
    at Object.reflectTypeFromMetadata (/home/yaslix/projects/vp/node_modules/@nestjs/graphql/dist/utils/reflection.utilts.js:11:26)

I'm not sure if this is due to esbuild not supporting emitDecoratorMetadata.
This problem occurs exactly with this kind of code:

@Query(() => String)
 getOneSettings(@Args() name: string) {
   return name;
 }

If i remove the @Args() name: string it works properly.
@Args is coming from @nestjs/graphql

ReferenceError: fetch is not defined

I've clone the repo, and cd example directory(express),and install packages, and npm run dev, when I try to entry http://localhost:3699/ip, I got error:

ReferenceError: fetch is not defined

how to extra config to app

import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';

if (process.env.NODE_ENV === 'production') {
  async function bootstrap() {
    const app = await NestFactory.create(AppModule);


   // here is my extra operation about app,
    app.setGlobalPrefix('/base/');
    app.set('trust proxy', true);
    app.disable('x-powered-by');
   // ....

    await app.listen(3000);
  }

  bootstrap();
}

export const viteNodeApp = NestFactory.create(AppModule);

after that, my extra config about app did not work,i want to know how to organize my code

Local .swcrc with module section cause Error when evaluating SSR module ./src/main.ts

Local .swcrc with module section cause:
Error when evaluating SSR module ./src/main.ts

Looks like vite-plugin-node does not like when 'module' section exists in .swcrc, when I removed it
everything started working, before that I got:

Error when evaluating SSR module ./src/main.ts:
ReferenceError: exports is not defined
    at src/main.ts:2:23
    at instantiateModule

nestjs Error when evaluating SSR module

12:32:41 PM [vite] Error when evaluating SSR module /src/app.module.ts:
Error: Failed to resolve import "src/guards/gql-auth.guard" from "src/auth/auth.module.ts". Does the file exist?
at formatError (/s/node_modules/vite/dist/node/chunks/dep-972722fa.js:51153:46)
at TransformContext.error (/s/node_modules/vite/dist/node/chunks/dep-972722fa.js:51149:19)
at normalizeUrl (/s/node_modules/vite/dist/node/chunks/dep-972722fa.js:74554:26)
at async TransformContext.transform (/s/node_modules/vite/dist/node/chunks/dep-972722fa.js:74687:57)
at async Object.transform (/s/node_modules/vite/dist/node/chunks/dep-972722fa.js:51354:30)
at async transformRequest (/s/node_modules/vite/dist/node/chunks/dep-972722fa.js:67098:29)
at async instantiateModule (/s/node_modules/vite/dist/node/chunks/dep-972722fa.js:73732:10)

Errors with export in `browser-external:...`

Repro: https://github.com/kasbah/vite-plugin-node-example

When I run:

npx vite

I get

✘ [ERROR] No matching export in "browser-external:child_process" for import "fork"

    node_modules/bullmq/dist/esm/classes/child-pool.js:1:9:
      1 │ import { fork } from 'child_process';
        ╵          ~~~~

✘ [ERROR] No matching export in "browser-external:util" for import "promisify"

    node_modules/bullmq/dist/esm/classes/child-processor.js:1:9:
      1 │ import { promisify } from 'util';
        ╵          ~~~~~~~~~

✘ [ERROR] No matching export in "browser-external:crypto" for import "createHash"

    node_modules/bullmq/dist/esm/commands/script-loader.js:1:9:
      1 │ import { createHash } from 'crypto';
        ╵          ~~~~~~~~~~

✘ [ERROR] No matching export in "browser-external:util" for import "promisify"

    node_modules/bullmq/dist/esm/commands/script-loader.js:5:9:
      5 │ import { promisify } from 'util';
        ╵          ~~~~~~~~~

✘ [ERROR] No matching export in "browser-external:events" for import "EventEmitter"

    node_modules/bullmq/dist/esm/classes/redis-connection.js:1:9:
      1 │ import { EventEmitter } from 'events';
        ╵          ~~~~~~~~~~~~

✘ [ERROR] No matching export in "browser-external:util" for import "debuglog"

    node_modules/bullmq/dist/esm/classes/job.js:3:9:
      3 │ import { debuglog } from 'util';
        ╵          ~~~~~~~~

✘ [ERROR] No matching export in "browser-external:events" for import "EventEmitter"

    node_modules/bullmq/dist/esm/classes/queue-base.js:1:9:
      1 │ import { EventEmitter } from 'events';
        ╵          ~~~~~~~~~~~~

✘ [ERROR] No matching export in "browser-external:crypto" for import "createHash"

    node_modules/bullmq/dist/esm/classes/repeat.js:2:9:
      2 │ import { createHash } from 'crypto';
        ╵          ~~~~~~~~~~

✘ [ERROR] No matching export in "browser-external:events" for import "EventEmitter"

    node_modules/bullmq/dist/esm/classes/compat.js:21:9:
      21 │ import { EventEmitter } from 'events';
         ╵          ~~~~~~~~~~~~

✘ [ERROR] No matching export in "browser-external:events" for import "EventEmitter"

    node_modules/bullmq/dist/esm/classes/flow-producer.js:

NestJS: vite command not working

Running vite with NestJS fails with the following error (build is working):

Pre-bundling dependencies:
  @nestjs/core
  @nestjs/common                                                                                                                                                                                                                              
(this will be run only when your dependencies or config have changed)
✘ [ERROR] Could not resolve "@nestjs/microservices"

    node_modules/@nestjs/core/nest-factory.js:52:128:
      52 │         const { NestMicroservice } = (0, load_package_util_1.loadPackage)('@nestjs/microservices', 'NestFactory', () => require('@nestjs/microservices'));
         ╵                                                                                                                                 ~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "@nestjs/microservices" as external to exclude it from the bundle, which
  will remove this error. You can also surround this "require" call with a try/catch block to handle
  this failure at run-time instead of bundle-time.

✘ [ERROR] Could not resolve "cache-manager"

    node_modules/@nestjs/common/cache/cache.providers.js:16:116:
      16 │             const cacheManager = (0, load_package_util_1.loadPackage)('cache-manager', 'CacheModule', () => require('cache-manager'));
         ╵                                                                                                                     ~~~~~~~~~~~~~~~

  You can mark the path "cache-manager" as external to exclude it from the bundle, which will remove
  this error. You can also surround this "require" call with a try/catch block to handle this
  failure at run-time instead of bundle-time.

✘ [ERROR] Could not resolve "class-validator"

    node_modules/@nestjs/common/pipes/validation.pipe.js:31:182:
      31 │         return (validatorPackage !== null && validatorPackage !== void 0 ? validatorPackage : (0, load_package_util_1.loadPackage)('class-validator', 'ValidationPipe', () => require('class-validator')));
         ╵                                                                                                                                                                                       ~~~~~~~~~~~~~~~~~

  You can mark the path "class-validator" as external to exclude it from the bundle, which will
  remove this error. You can also surround this "require" call with a try/catch block to handle this
  failure at run-time instead of bundle-time.

✘ [ERROR] Could not resolve "class-transformer"

    node_modules/@nestjs/common/serializer/class-serializer.interceptor.js:22:252:
      22 │ ...ltOptions === void 0 ? void 0 : defaultOptions.transformerPackage) !== null && _a !== void 0 ? _a : (0, load_package_util_1.loadPackage)('class-transformer', 'ClassSerializerInterceptor', () => require('class-transformer'));
         ╵                                                                                                                                                                                                              ~~~~~~~~~~~~~~~~~~~

  You can mark the path "class-transformer" as external to exclude it from the bundle, which will
  remove this error. You can also surround this "require" call with a try/catch block to handle this
  failure at run-time instead of bundle-time.

✘ [ERROR] Could not resolve "class-transformer"

    node_modules/@nestjs/common/pipes/validation.pipe.js:34:190:
      34 │         return (transformerPackage !== null && transformerPackage !== void 0 ? transformerPackage : (0, load_package_util_1.loadPackage)('class-transformer', 'ValidationPipe', () => require('class-transformer')));
         ╵                                                                                                                                                                                               ~~~~~~~~~~~~~~~~~~~

  You can mark the path "class-transformer" as external to exclude it from the bundle, which will
  remove this error. You can also surround this "require" call with a try/catch block to handle this
  failure at run-time instead of bundle-time.

✘ [ERROR] Could not resolve "@nestjs/websockets/socket-module"

    node_modules/@nestjs/core/nest-application.js:18:115:
      18 │ const { SocketModule } = (0, optional_require_1.optionalRequire)('@nestjs/websockets/socket-module', () => require('@nestjs/websockets/socket-module'));
         ╵                                                                                                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "@nestjs/websockets/socket-module" as external to exclude it from the
  bundle, which will remove this error. You can also surround this "require" call with a try/catch
  block to handle this failure at run-time instead of bundle-time.

✘ [ERROR] Could not resolve "@nestjs/microservices/microservices-module"

    node_modules/@nestjs/core/nest-application.js:19:132:
      19 │ const { MicroservicesModule } = (0, optional_require_1.optionalRequire)('@nestjs/microservices/microservices-module', () => require('@nestjs/microservices/microservices-module'));
         ╵                                                                                                                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "@nestjs/microservices/microservices-module" as external to exclude it from
  the bundle, which will remove this error. You can also surround this "require" call with a
  try/catch block to handle this failure at run-time instead of bundle-time.

✘ [ERROR] Could not resolve "@nestjs/microservices"

    node_modules/@nestjs/core/nest-application.js:117:128:
      117 │         const { NestMicroservice } = (0, load_package_util_1.loadPackage)('@nestjs/microservices', 'NestFactory', () => require('@nestjs/microservices'));
          ╵                                                                                                                                 ~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "@nestjs/microservices" as external to exclude it from the bundle, which
  will remove this error. You can also surround this "require" call with a try/catch block to handle
  this failure at run-time instead of bundle-time.

Using with standard node server?

Is there a way to use this with without one of the adapters. I have just a standard NodeJS that doesn't use any framework (It just runs a WebSocket server)

Repo example for express cannot find module '@swc/core'

From examples/express I had to first delete yarn.lock because I got this output:

yarn install v1.22.18
[1/4] Resolving packages...
[2/4] Fetching packages...
error https://registry.yarnpkg.com/vite-plugin-node/-/vite-plugin-node-0.0.19.tgz: Integrity check failed for "vite-plugin-node" (computed integrity doesn't match our records, got "sha512-Nwindxk2nfp9ZQZQovmKr+wdBH+17Czf8PUo+sAABnmOtebtE4Zo+Dq055SA5CPzLVVWylJ454k98BH4TpMhZA== sha1-e6eYblHkijap8RnfxSFlfvHM12I=")
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

After deleting yarn.lock and running yarn I got:

failed to load config from /home/romigui/git/vite-plugin-node/examples/express/vite.config.ts
error when starting dev server:
Error: Cannot find module '@swc/core'
Require stack:
- /home/romigui/git/vite-plugin-node/examples/express/node_modules/vite-plugin-node/dist/rollup-plugin-swc.js
- /home/romigui/git/vite-plugin-node/examples/express/node_modules/vite-plugin-node/dist/index.js
- /home/romigui/git/vite-plugin-node/examples/express/vite.config.ts
- /home/romigui/git/vite-plugin-node/examples/express/node_modules/vite/dist/node/chunks/dep-27bc1ab8.js
- /home/romigui/git/vite-plugin-node/examples/express/node_modules/vite/dist/node/cli.js
- /home/romigui/git/vite-plugin-node/examples/express/node_modules/vite/bin/vite.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:101:18)
    at Object.<anonymous> (/home/romigui/git/vite-plugin-node/examples/express/node_modules/vite-plugin-node/dist/rollup-plugin-swc.js:5:16)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Module.require (internal/modules/cjs/loader.js:974:19)

If I add @swc/core, it does work.

swc tsCompiler does not seem to do anything

Steps taken:

  1. Create fresh nestjs application
  2. Add @swc/core to dev dependencies
  3. Create vite.config.ts
  4. Update src/main.ts

Error:
image

vite.config.ts
image

src/main.ts
image

When removing the tsCompiler option I get the same error, but I was under the impression swc would fix reflect-metadata doesn't appear to be written in CJS, but also doesn't appear to be a valid ES module (i.e. it doesn't have "type": "module" or an .mjs extension for the entry point). Please contact the package author to fix.

package.json:

{
  "name": "api",
  "version": "1.0.0",
  "private": true,
  "license": "MIT",
  "scripts": {
    "prebuild": "rimraf dist",
    "build": "vite build",
    "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
    "dev": "vite",
    "start": "nest start",
    "start:dev": "nest start --watch",
    "start:debug": "nest start --debug --watch",
    "start:prod": "node dist/main",
    "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
    "test": "vitest",
    "test:watch": "vitest --watch",
    "test:cov": "vitest --coverage"
  },
  "dependencies": {
    "@nestjs/common": "^8.0.0",
    "@nestjs/core": "^8.0.0",
    "@nestjs/platform-express": "^8.0.0",
    "class-transformer": "^0.5.1",
    "class-validator": "^0.13.2",
    "reflect-metadata": "^0.1.13",
    "rimraf": "^3.0.2",
    "rxjs": "^7.2.0"
  },
  "devDependencies": {
    "@nestjs/cli": "^8.0.0",
    "@nestjs/schematics": "^8.0.0",
    "@nestjs/testing": "^8.0.0",
    "@swc/core": "^1.2.187",
    "@types/express": "^4.17.13",
    "@types/node": "^16.0.0",
    "@types/supertest": "^2.0.11",
    "config": "workspace:*",
    "source-map-support": "^0.5.20",
    "supertest": "^6.1.3",
    "ts-loader": "^9.2.3",
    "ts-node": "^10.0.0",
    "tsconfig": "workspace:*",
    "tsconfig-paths": "^3.10.1",
    "typescript": "^4.3.5",
    "vite": "^2.9.9",
    "vite-plugin-node": "^0.0.19"
  },
  "jest": {
    "moduleFileExtensions": [
      "js",
      "json",
      "ts"
    ],
    "rootDir": "src",
    "testRegex": ".*\\.spec\\.ts$",
    "transform": {
      "^.+\\.(t|j)s$": "vitest"
    },
    "collectCoverageFrom": [
      "**/*.(t|j)s"
    ],
    "coverageDirectory": "../coverage",
    "testEnvironment": "node"
  }
}

require is not defined - should I start with es6?

This was mentioned elsewhere.

Trying to use body-parser but getting an error.

11:14:57 AM [vite] Error when evaluating SSR module /node_modules/body-parser/index.js:
ReferenceError: require is not defined
    at /node_modules/body-parser/index.js:14:17
    at instantiateModule (/opt/homebrew/lib/node_modules/vite/dist/node/chunks/dep-6b5f3ba8.js:68222:166)
node:internal/process/promises:246
          triggerUncaughtException(err, true /* fromPromise */);
          ^

ReferenceError: require is not defined
    at /node_modules/body-parser/index.js:14:17
    at instantiateModule (/opt/homebrew/lib/node_modules/vite/dist/node/chunks/dep-6b5f3ba8.js:68222:166)

I want to wrap my head around something: vite uses es6 but express does not? So how does this plugin get around that? Am I suppose to be using express through es6 (I assume through babel) and only then use vite-plugin-node?

Thank you

Build for production?

Hi. I've tried your plugin, as it seems my last chance of making my setup working. It seems really great, but I am not sure to understand how to use it for production.

I have a fairly sophisticated express.js-based backend, and I try to build into a custom folder dist-prod that I deploy to heroku. But I can't find how to run vite build and end up with the correct output.

As far as I understand, your plugin isn't ready to build for production, right? Anything I can do to help? Thanks a lot.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.