Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@deinstapel/environment-loader

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@deinstapel/environment-loader

This is a loader for webpack to be able to load dynamic configurations. The goal is, that you can replace the "bundled" configuration with your own in your deployment. This allows you to use the same container for different deployments without rebuilding

  • 0.0.5
  • latest
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

environment-loader

This is a loader for webpack to be able to load dynamic configurations. The goal is, that you can replace the "bundled" configuration with your own in your deployment. This allows you to use the same container for different deployments without rebuilding the entire applications with different environment variables.

Usage

webpack.config.js

module.exports = {
    module: {
        rules: [
            {
                test: /environment\.(json)$/,
                type: 'javascript/auto',
                use: [
                    '@deinstapel/environment-loader',
                    {
                        loader: 'file-loader',
                        options: {
                            outputPath: '/config/',
                            name: '[name].[ext]',
                        }
                    }
                ]
            }
        ]
    }
}
   
import environment from "../config/environment.json"

environment.then((env) => {
    // Environment can be used  
})

How it works

The file-loader places the file in the build directory to /config/environment.json and passes module.exports = /config/environment.json to the @deinstapel/environment-loader, which parses and loads the url and return a promise, which can be evaluated by the user later on.

FAQs

Package last updated on 15 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc