{"action":"created","issue":{"url":"https://api.github.com/repos/systemjs/builder/issues/417","labels_url":"https://api.github.com/repos/systemjs/builder/issues/417/labels{/name}","comments_url":"https://api.github.com/repos/systemjs/builder/issues/417/comments","events_url":"https://api.github.com/repos/systemjs/builder/issues/417/events","html_url":"https://github.com/systemjs/builder/issues/417","id":119511672,"number":417,"title":"disabling normalize breaks static build","user":{"login":"yoavniran","id":1102278,"avatar_url":"https://avatars.githubusercontent.com/u/1102278?v=3","gravatar_id":"","url":"https://api.github.com/users/yoavniran","html_url":"https://github.com/yoavniran","followers_url":"https://api.github.com/users/yoavniran/followers","following_url":"https://api.github.com/users/yoavniran/following{/other_user}","gists_url":"https://api.github.com/users/yoavniran/gists{/gist_id}","starred_url":"https://api.github.com/users/yoavniran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yoavniran/subscriptions","organizations_url":"https://api.github.com/users/yoavniran/orgs","repos_url":"https://api.github.com/users/yoavniran/repos","events_url":"https://api.github.com/users/yoavniran/events{/privacy}","received_events_url":"https://api.github.com/users/yoavniran/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-11-30T15:12:17Z","updated_at":"2015-12-03T09:54:14Z","closed_at":null,"body":"continuing from the thread at: jspm/jspm-cli#1314\r\n\r\nIn the project im working on, im doing dynamic requires, as in, the name of the module I require is constructed at runtime based on configuration that is provided at build time. I had trouble getting this to work but found an almost adequate solution by setting the compile option \"encodeNames\" to false. However this left a couple of problems, 1) the \".js\" extension was left in the dependency names (annoying be workable) and 2) the aliases from my config.js were ignored.\r\n\r\nMy config.js looks something like this:\r\n\r\n```js\r\nSystem.config({\r\n   //...\r\n     meta: {\r\n          \"jtvw.integrations/integrationsProvider\":{\r\n            \"format\": \"cjs\",\r\n            \"deps\": [\"jtvw.integrations/facebook/fbIntegrator\",\r\n                \"jtvw.integrations/twitter/twitterIntegrator\"]\r\n        },\r\n    },\r\n     map: {\r\n          //...\r\n       \"jtvw.integrations\": \"src/integrations\",\r\n         //...\r\n      }\r\n});\r\n```\r\nSo in my code (integrations provider) I would like to do something like this:\r\n\r\n```js\r\nrequire(\"jtvw.integrations/\" + name + \"/\" + config.intName); //ex: name = facebook, config.intName = fbIntegrator\r\n```\r\nWith just encodeNames set to false, I get in the bundled code: \r\n\r\n```js\r\n$__System.registerDynamic(\"src/integrations/integrationsProvider.js\", [\"web-commons\", \"promise\", \r\n\"utils\", \"Logger\", \"src/integrations/facebook/fbIntegrator.js\", \"src/integrations/twitter/twitterIntegrator.js\"], \r\ntrue, function($__require, exports, module) {\r\n//...\r\n```\r\nThe dependency names dont match my config or my code... :disappointed: \r\n\r\nSo I realized that passing \"normalize = false\" will make the dependency names stay as I want them: \r\n\r\n```js\r\n$__System.registerDynamic(\"src/integrations/integrationsProvider.js\", [\"web-commons\", \"promise\", \r\n\"utils\", \"Logger\", \"jtvw.integrations/facebook/fbIntegrator\", \"jtvw.integrations/twitter/twitterIntegrator\"], \r\ntrue, function($__require, exports, module) {\r\n//...\r\n```\r\n\r\nbut... now I have a bigger problem, the require calls inside the module arent renamed correctly, even for the normal (not dynamic) dependencies and the resulting code is:\r\n\r\n``` js\r\n$__System.registerDynamic(\"src/integrations/integrationsProvider.js\", [\"web-commons\", \"promise\",\r\n \"utils\", \"Logger\", \"jtvw.integrations/facebook/fbIntegrator\", \"jtvw.integrations/twitter/twitterIntegrator\"],\r\n true, function($__require, exports, module) {\r\n  ;\r\n  var global = this,\r\n      __define = global.define;\r\n  global.define = undefined;\r\n  module.exports = (function() {\r\n    \"use strict\";\r\n    var _ = require(\"web-commons\").common,\r\n        Promise = require(\"promise\").Promise,\r\n        utils = require(\"utils\"),\r\n        logger = require(\"Logger\").getLogger();\r\n//...\r\n```\r\n\r\nnotice that the module function receives \"**$__require**\" while inside the calls are left as \"**require**\" which of course fails with \"require is not defined\" Error.\r\n\r\nAm I missing something here? does disabling normalize also means the require method isnt renamed on purpose or is it a bug?\r\n\r\nthanks."},"comment":{"url":"https://api.github.com/repos/systemjs/builder/issues/comments/161571862","html_url":"https://github.com/systemjs/builder/issues/417#issuecomment-161571862","issue_url":"https://api.github.com/repos/systemjs/builder/issues/417","id":161571862,"user":{"login":"yoavniran","id":1102278,"avatar_url":"https://avatars.githubusercontent.com/u/1102278?v=3","gravatar_id":"","url":"https://api.github.com/users/yoavniran","html_url":"https://github.com/yoavniran","followers_url":"https://api.github.com/users/yoavniran/followers","following_url":"https://api.github.com/users/yoavniran/following{/other_user}","gists_url":"https://api.github.com/users/yoavniran/gists{/gist_id}","starred_url":"https://api.github.com/users/yoavniran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yoavniran/subscriptions","organizations_url":"https://api.github.com/users/yoavniran/orgs","repos_url":"https://api.github.com/users/yoavniran/repos","events_url":"https://api.github.com/users/yoavniran/events{/privacy}","received_events_url":"https://api.github.com/users/yoavniran/received_events","type":"User","site_admin":false},"created_at":"2015-12-03T09:54:14Z","updated_at":"2015-12-03T09:54:14Z","body":"With what you're suggesting would this be correct?\r\n\r\n```js\r\n//will work:\r\nconst MyModule = require(\"app.integrations/\" + \"myIntegrator.js\");\r\n\r\n//wont work(?):\r\nconst myModulePath = \"app.integrations/\" + \"myIntegrator.js\";\r\nconst MyModule = require(myModulePath);\r\n```\r\n\r\nAlso, would I be able to use the aliases in my config for the \"deps\" as well as in my code? As now its not an option for the dynamically constructed paths."}}