question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add raw loader to webpack

See original GitHub issue

I think a cool feature would be to add raw-loader from webpack to the configuration

the main benefit that it would allow us to import certificates as dependencies, to programatically connect to, let’s say, a documentdb instance

import { MongoClient } from "mongodb";
import caBundle from "raw-loader!./path/to/rds-combined-ca-bundle.pem";

let cachedDb = null;

function connectToDatabase() {
    if (cachedDb) {
        return Promise.resolve(cachedDb);
    }

    return MongoClient.connect(
        process.env.MONGODB_URI,
        { ssl: true, sslCA: caBundle }
    ).then(db => {
        cachedDb = db;
        return cachedDb;
    });
}

export const handler = async (event, context) => {
    const db = await connectToDatabase();
    // Do something with it...
};

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jayaircommented, May 17, 2020

I think so. If somebody wants to take this on and add a PR, we can add it in.

1reaction
gndeliacommented, Nov 18, 2019

I think I can create a PR add it during the week

Read more comments on GitHub >

github_iconTop Results From Across the Web

raw-loader - webpack - JS.ORG
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >
webpack-contrib/raw-loader - GitHub
A loader for webpack that allows importing files as a String. Getting Started. To begin, you'll need to install raw-loader : $ npm...
Read more >
raw-loader - npm
A loader for webpack that allows importing files as a String. Latest version: 4.0.2, last published: 2 years ago. Start using raw-loader in ......
Read more >
raw-loader - webpack
A loader for webpack that allows importing files as a String. Getting Started. To begin, you'll need to install raw-loader : $ npm...
Read more >
raw-loader - webpack 3 documentation
A loader for webpack that allows importing files as a String. Getting Started. To begin, you'll need to install raw-loader : $ npm...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found