README
RNA Dev Server • A webapp server based on Web Dev Server.
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
$ npm i @chialab/rna @chialab/rna-dev-server -D
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 koa from 'koa';
import { loadDevServerConfig, createDevServer, koaMiddleware } from '@chialab/rna-dev-server';
const app = koa();
const config = await loadDevServerConfig();
const devServer = await createDevServer(config);
app.use(koaMiddleware(devServer));
Integrations
- RNA CakePHP: an Encore-like view helper to inject scripts and css
License
RNA Dev Server is released under the MIT license.