@knot/webpack-plugin
A
webpack
plugin to automatically handle parsing and transformingknot
code.
Integrate knot
into your existing webpack
build easily using this plugin.
Table of Contents
Install
npm install @knot/webpack-plugin
# or
yarn add @knot/webpack-plugin
Usage
In order to use knot
modules with webpack
only requires 2 pieces of configuration.
- Add
'.kn'
to the list of extensions to consider when resolving modules - Add an instance of the
KnotPlugin
to the list of plugins
// webpack.config.js
import KnotPlugin from '@knot/webpack-plugin';
module.exports = {
// add these to your existing configuration
resolve: {
extensions: ['.kn', '.js']
},
plugins: [
new KnotPlugin({
// optionally print an exhaustive log of the operation of the compiler
// debug: true,
})
]
};
You will now be able to import a .kn
file from any normal javascript file.
When running webpack
, these files will be automatically converted into native javascript modules.
There is also a more robust example.
Maintainers
Contributing
PRs accepted.
Small note: If editing the README, please conform to the standard-readme specification.
License
MIT © 2019 Ben Teichman