Open Bug 1231453 Opened 9 years ago Updated 2 years ago

Investigate loader compatibility with node_modules

Categories

(DevTools :: Framework, task)

40 Branch
task

Tracking

(Not tracked)

People

(Reporter: jlong, Unassigned)

References

(Blocks 1 open bug)

Details

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.
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 `moz.build` 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.
Component: Developer Tools: Debugger → Developer Tools: Framework
Product: Firefox → DevTools
Type: defect → task
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.