From 72d86fb8514fe37f846f73660f186a3ab75165ed Mon Sep 17 00:00:00 2001 From: Erekose Craft <8909290+AirAKose@users.noreply.github.com> Date: Sun, 21 Jul 2019 00:45:03 -0400 Subject: [PATCH] Add "browser" alternative path to package.json Recently ran into an issue with the npm version of requirejs where I was accidentally pushing the compiled version (r.js) to browser clients because of a generic script redirector checking node_module packages for their main paths. This redirector checks for "browser" first and then falls back to "main" (or defaults to either "index.js" or "{name}.js" if that's missing). I'm just recently trying to get back into the webdev game, so please let me know if there's a history here or any reason that the "browser" field hasn't seen wider adoption! It seems like a great generic solution to packaging and delivery problems. --- requirejs/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/requirejs/package.json b/requirejs/package.json index 31e9c4d..86a9c66 100644 --- a/requirejs/package.json +++ b/requirejs/package.json @@ -10,6 +10,7 @@ "url": "https://github.com/jrburke/r.js.git" }, "main": "./bin/r.js", + "browser": "./require.js", "bin": { "r.js": "./bin/r.js", "r_js": "./bin/r.js"