0.1.1 • Published 1 year ago

const-module-loader v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Installation

# NPM
$ npm install const-module-loader
# Yarn
$ yarn add const-module-loader
# PNPM
$ pnpm add const-module-loader
# Bun
$ bun add const-module-loader

Usage

Depending on what framework you are using your configuration will look slightly different. If you are using a Vite based framework you should instead look towards vite-plugin-const, which is the same functionality but for Vite based frameworks.

Webpack

Add const-module-loader as a module rules in your webpack.config.js.

module.exports = {
  //...
  module: {
    rules: [
      {
        test: /\.const.ts/,
        use: [{ loader: "const-module-loader" }],
      },
    ],
  },
};

NextJS

Add const-module-loader as a module rules in the webpack section of your next.config.mjs.

/** @type {import('next').NextConfig} */
const nextConfig = {
  webpack: (
    config,
    { buildId, dev, isServer, defaultLoaders, nextRuntime, webpack }
  ) => {
    config.module.rules.push({
      test: /\.const.ts/,
      use: [{ loader: "const-module-loader" }],
    });

    return config;
  },
};

License

Distributed under the MIT License. See LICENSE for more information.

0.1.1

1 year ago

0.1.0

1 year ago