You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Björn b963b3396c
init
5 years ago
..
dist init 5 years ago
LICENSE init 5 years ago
README.md init 5 years ago
package.json init 5 years ago

README.md

Riot.js webpack-loader

Build Status Issue Count NPM version NPM downloads MIT License

Riot.js official webpack loader

Important

If you are using Riot.js < 4.0.0 please check the v3 branch

Installation

npm i @riotjs/webpack-loader @riotjs/compiler -D

Usage

Add the @riotjs/webpack-loader in your webpack.config.js file

module.exports = {
  module: {
    rules: [
      {
        test: /\.riot$/,
        exclude: /node_modules/,
        use: [{
          loader: '@riotjs/webpack-loader',
          options: {
            hot: false, // set it to true if you are using hmr
            // add here all the other @riotjs/compiler options riot.js.org/compiler
            // template: 'pug' for example
          }
        }]
      }
    ]
  }
}

If you want to enable hmr via hot option you will need to install also @riotjs/hot-reload

npm i @riotjs/hot-reload -D

And afterwards webpack will be able to automatically reload your Riot.js components in runtime.

Examples

Please check this simple example to see how it's easy to configure webpack with riot