livescript-plugin-loader

Livescript Loader for Webpack with plugin support

Usage no npm install needed!

<script type="module">
  import livescriptPluginLoader from 'https://cdn.skypack.dev/livescript-plugin-loader';
</script>

README

Livescript Loader for Webpack with plugin support.

I'm using it for my personal project so it is probably almost production ready - I'm talking about loader itself plugins are different story.

Repository on github

Plugins

Installation

Install loader with

npm install --save-dev livescript-plugin-loader

Configuration

Add loader rule to your webpack.config.ls

module.exports =
    module:
        rules:
          * test: /\.ls$/
            exclude: /(node_modules|bower_components)/
            use: [
              * loader: \livescript-plugin-loader
            ]
          ...  

Source maps

In Firefox I advice to use

devtool: 'source-map'

and in Chrome

devtool: 'eval-source-map'

Plugins

First install plugins that you want to use

npm install --save-dev livescript-transform-top-level-await

Next add them to property options.plugins in loader configuration section in webpack.config.ls

* loader: \livescript-plugin-loader
  options:
      plugins: <[
          livescript-transform-implicit-async
          livescript-transform-object-create
      ]>

If you want to pass some options to plugin use object instead of array

* loader: \livescript-plugin-loader
  options:
      plugins:
          \livescript-transform-esm : format: \cjs

Or use objects instead of strings

* loader: \livescript-plugin-loader
  options:
      plugins:
        * name: \livescript-transform-object-create
          options: format: \esm
        ...

Atom integration

If you are using Atom editor you may be interested in my packages which provide realtime code preview.

Under the hood they use the very same plugins as this loader.

Implementation

This loader is small - 62 lines - and quite simple, it does only three things:

  1. Creates compiler instance
  2. Loads plugins into compiler
  3. Executes compiler

License

BSD-3-Clause