Add raw loader to webpack
See original GitHub issueI 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:
- Created 4 years ago
- Reactions:3
- Comments:10 (6 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think so. If somebody wants to take this on and add a PR, we can add it in.
I think I can create a PR add it during the week