Use this module with bundled node modules (using webpack)
See original GitHub issueHi there
I’m coming over from an issue on DataDog/dd-trace-js#827 where I figured out, the issue actually lies in this library.
We are using webpack to bundle our application and all the required node modules in a single bundle. Now we installed dd-trace-js which uses require-in-the-middle
to hook up its plugins. However, for us the require-in-the-middle
does not work if the node modules are bundled. Is this a know inssue? Is there a way to use require-in-the-middle
with bundled node modules?
I worked around the issue using webpack-node-externals but I would prefer going back to including the node modules in the bundle.
Thanks, Michael
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:14 (2 by maintainers)
Top Results From Across the Web
Webpack - Getting node modules Into Bundle and loading into ...
I've read the tutorial and beginning steps but am stuck. I have used webpack to generate bundle.js with the webpack config below and...
Read more >How to bundle your library for both NodeJS and Browser with ...
What is worth mentioning here is: target set to node; externals — where we use webpack-node-externals module to define the externals ...
Read more >How to transpile ES modules with webpack and Node.js
Learn how webpack interacts with and supports ES modules in this deep dive tutorial on transpilation in Node.js.
Read more >Module Methods - webpack
When using webpack to bundle your application, you can pick from a variety of module syntax styles including ES6, CommonJS, and AMD.
Read more >How webpack decides what to bundle - Jakob Lind
Does webpack just take everything in node_modules and put it in the bundle ... Let's take back control by looking inside that black...
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
Hi @techmunk , i did also checked with your solution but im getting “modules not defiend”,
For anyone interested in this, I’ve written a Webpack Plugin that can do this WITHOUT needing to patch or change code in require-in-the-middle.
What follows is typescript code, so make changes as needed for JS.
To use:
The list of modules above is taken straight from elastic-apm-node. If elastic-apm-node exported the modules, would probably not even need that!
This is tested against webpack 4 with an effort to get elastic-apm-node to work with a full bundled webpack build.