Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save juliandescottes/f3cbd43dc337b20da47a13e5ef56748d to your computer and use it in GitHub Desktop.
Save juliandescottes/f3cbd43dc337b20da47a13e5ef56748d to your computer and use it in GitHub Desktop.
diff --git a/packages/devtools-launchpad/webpack.config.devtools.js b/packages/devtools-launchpad/webpack.config.devtools.js
index be7f9cb..f7f9bc2 100644
--- a/packages/devtools-launchpad/webpack.config.devtools.js
+++ b/packages/devtools-launchpad/webpack.config.devtools.js
@@ -31,6 +31,21 @@ module.exports = (webpackConfig, envConfig, options) => {
return;
}
+ // I would like to run this only for parser-worker but I'm not sure how :)
+ if (request.includes("lodash/")) {
+ // This will generate small modules containing simply
+ // `module.exports = exported = __lodash.toPairs;`
+ // We expect __lodash to be available globally
+ let module = request.replace("lodash/", "");
+ let importer = `var exported = __lodash.${module}`;
+ callback(null, importer);
+ return;
+ }
+ // After generating parser-worker, the last step is to add the following lines right
+ // below the first line:
+ // importScripts("resource://gre/modules/workers/require.js");
+ // __lodash = require("resource://devtools/client/shared/vendor/lodash.js");
+
// Any matching paths here won't be included in the bundle.
const excludeMap = (options && options.excludeMap) || nativeMapping;
if (excludeMap[mod]) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment