1.0.0 • Published 3 years ago

@funexp/webpack-loader v1.0.0

Weekly downloads
-
License
AGPL-3.0
Repository
github
Last release
3 years ago

@funexp/webpack-loader

The Webpack loader used to integrate funexp with your projects.

Usage

You can use it to load .fun files that contains all the instructions to be compiled:

webpack.config.js

module.exports = {
    entry: "./index.js",
    module: {
        rules: [
            {
                test: /\.fun$/,
                use: "@funexp/webpack-loader"
            }
        ]
    }
};

regex.fun

group(name="letter")
    any
space
literal|is for fun!

index.js

const regex = require("./regex.fun");
console.log("F is for fun!".match(regex));

You can also use it to load files that contains Javascript template literals having the tag fun, that will be compiled into RegExp:

webpack.config.js

module.exports = {
    entry: "./index.js",
    module: {
        rules: [
            {
                test: /\.js$/,
                use: "@funexp/webpack-loader"
            }
        ]
    }
};

index.js

const regex = fun`
group(name="letter")
    any
space
literal|is for fun!
`;

console.log("F is for fun!".match(regex));
1.0.0

3 years ago