Nincompoops Producing Methane

    swc-loader

    0.1.15 • Public • Published

    swc-loader

    This package allows transpiling JavaScript files using swc and webpack.

    Installation

    npm i --save-dev @swc/core swc-loader webpack

    Usage

    module: {
        rules: [
            {
                test: /\.m?js$/,
                exclude: /(node_modules|bower_components)/,
                use: {
                    // Use `.swcrc` to configure swc
                    loader: "swc-loader"
                }
            }
        ];
    }

    You can pass options to the loader by using the option property.

    module: {
        rules: [
            {
                test: /\.ts$/,
                exclude: /(node_modules|bower_components)/,
                use: {
                    loader: "swc-loader",
                    options: {
                        jsc: {
                            parser: {
                                syntax: "typescript"
                            }
                        }
                    }
                }
            }
        ];
    }

    If you get an error while using swc-loader, you can pass sync: true to get correct error message.

    module: {
        rules: [
            {
                test: /\.ts$/,
                exclude: /(node_modules|bower_components)/,
                use: {
                    loader: "swc-loader",
                    options: {
                        // This makes swc-loader invoke swc synchronously.
                        sync: true,
                        jsc: {
                            parser: {
                                syntax: "typescript"
                            }
                        }
                    }
                }
            }
        ];
    }

    Configuration Reference

    Refer https://swc.rs/docs/configuring-swc

    Keywords

    none

    Install

    npm i swc-loader

    DownloadsWeekly Downloads

    49,414

    Version

    0.1.15

    License

    MIT

    Unpacked Size

    7.67 kB

    Total Files

    7

    Last publish

    Collaborators

    • kdy1