@chialab/rna-dev-server
TypeScript icon, indicating that this package has built-in type declarations

0.18.0 • Public • Published

RNA logo

RNA Dev Server • A webapp server based on Web Dev Server.

NPM


Install

npm i @chialab/rna-dev-server -D
yarn add @chialab/rna-dev-server -D

Usage

Start a web dev server that transforms ESM imports for node resolution on demand. It also uses esbuild to compile non standard JavaScript syntax.

Via import

import { serve } from '@chialab/rna';

/**
 * @see https://modern-web.dev/docs/dev-server/cli-and-configuration/
 */
await serve({
    // rootDir: '.',
});

Via cli

rna serve [options] [root]

Options:
  -P, --port <number>  server port number
  -C, --config <path>  the rna config file
  -h, --help           display help for command

Samples

rna serve
rna serve public --port 3000

As middleware

import { createServer } from 'http';
import express from 'express';
import { loadDevServerConfig, createDevServer } from '@chialab/rna-dev-server';

const app = express();
const server = createServer(app);
const config = await loadDevServerConfig({
    rootDir: 'src',
});
const devServer = await createDevServer(config);
await devServer.start(server);
app.use(devServer.callback());

Integrations

  • RNA CakePHP: a view helper to inject scripts and css with livereload.

License

RNA Dev Server is released under the MIT license.

Package Sidebar

Install

npm i @chialab/rna-dev-server

Weekly Downloads

74

Version

0.18.0

License

MIT

Unpacked Size

51 kB

Total Files

6

Last publish

Collaborators

  • chialab-admin
  • chialab-developers