Investigate loader compatibility with node_modules



3 years ago
3 months ago


(Reporter: jlong, Unassigned)


(Blocks: 1 bug)

40 Branch

Firefox Tracking Flags

(Not tracked)




3 years ago
A huge pain point right now is the inability to resolve modules to a central `node_modules` folder because `npm` will install modules there and the dependencies of those modules will also exist in there. For example, if we want to use `react-redux`, that library does `require("react")`. Currently we are manually changing those paths to `devtools/client/shared/...`.

We definitely need to be vigilant about keeping our dependencies small, but using `npm` to manage libraries without mess would be nice.

Comment 1

3 years ago
It turns out this is pretty hard. Even if the loader was npm-compatible (it was able to lookup modules in a `node_modules` directory), we have to individually list all files in a `` file which is pretty annoying.

And really when it comes down to it we want to discourage installing stuff from npm. We don't want to load in a ton of small modules.

With all this in mind I think I'm just going to write a small tool to automate installing stuff from npm. It will do things like rewrite requires to load from our `vendor` directory, and will also have specific build steps for packages like React. Think of it as just automating our "upgrade" steps.

Shouldn't be hard at all; we really only want ~6 or so packages from npm and I'll make those work. Adding a new package may require adding to this tool, not sure, but it would be good to make it hard to add a new package anyway.
Blocks: 1180760


2 years ago
Component: Developer Tools: Debugger → Developer Tools: Framework


3 months ago
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.