A ready to run, framework agnostic, zero configuration webpack 3 and webpack-dev-server build tool, without project generation.
Babel with ES2016, JSX, TypeScript, Sass, Less and autoprefixer are supported by default.
Included: dev server, unit tests, coverage, hot module replacement, and more ! (see features)
npm i -g runpack
You may also use it as a dev dependency.
Create an index.js or main.js file at the root of your project. You may also use .jsx, .ts or .tsx.
Like with webpack, the index file (with any supported extension) can be located inside the src directory (main is not supported though).
A package.json is not necessary, but if present and the main field is an existing file, it will be used as the entry point.
An index.html file is not mandatory, but if one is found next to the main file, it will be used.
To use a css file (or sass/scss/less), simply include it with require or import, in your main javascript file:
// ES5:
require('./path/to/file.css');
// ES6 or TypeScript:
import './path/to/file.css';
Run the developpment server (default port is already 3000):
runpack server --port 3000
Run the developpment server with cheap sourcemaps (faster builds but less precise sourcemaps, enable it on large projects):
runpack server --cheap-sourcemap
Run the developpment server with a backend server:
runpack server --proxy http://localhost:8080
Run the developpment server with a backend server and html5 history API (mandatory if using both proxy and html5 type routing):
runpack server --proxy http://localhost:8080 --proxy-root /rest --proxy-root /api
Build production files in /dist:
runpack build
Run server with basic hot module replacement (styles are supported):
runpack server --hot
Run server with hot module replacement and React support (you must use and module.hot.accept from react-hot-loader as in react-hot-ts to support hot module replacement in the application code):
runpack server --hot-react
Create a production archive (zip and .tar.gz are supported):
runpack package --type tgz
Run tests with mocha:
runpack test
Run tests and watch files:
runpack test --watch
Run tests with mocha and generate test reports:
runpack test --test-report
Run tests with mocha and generate a coverage report:
runpack test --coverage
Dump build scripts, generate npm commands and install dev depenencies (may be irreversible !):
runpack eject
By default, the favicon.png file next to your main javascript file will be used as a favicon, to define another path, use --favicon:
runpack server --favicon path/to/favicon
Get help:
runpack --help
Get help on a specific command:
runpack <command> --help
Version | Tag | Published |
---|---|---|
0.9.0 | latest | 1yr ago |
0.3.10-feat-proxy-root-2 | next | 5yrs ago |