livescript-plugin-loader
v2.0.0
Published
Livescript Loader for Webpack with plugin support
Downloads
5
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
- transform-esm - es modules import & export
- transform-implicit-async - automatic
async
insertion - transform-object-create -
Object.create
as an implementation of clone operator^^
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.
- livescript-ide-preview - show transpiled code
- atom-livescript-provider - provides compilation service
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:
- Creates compiler instance
- Loads plugins into compiler
- Executes compiler