@@ -100,21 +100,23 @@ def loader=(sym)
100
100
end
101
101
102
102
def build_config
103
- self [ :build_config ] = self . run_config . merge "baseUrl" => source_dir . to_s ,
104
- "modules" => [ { 'name' => 'application' } ]
105
- self [ :build_config ] . merge! ( self . user_config ) . slice! ( *self . build_config_whitelist )
106
- case self . loader
107
- when :requirejs
108
- # nothing to do
109
- when :almond
110
- mods = self [ :build_config ] [ 'modules' ]
111
- unless mods . length == 1
112
- raise Requirejs ::ConfigError , "Almond build requires exactly one module, config has #{ mods . length } ."
113
- end
114
- mod = mods [ 0 ]
115
- name = mod [ 'name' ]
116
- mod [ 'name' ] = 'almond'
117
- mod [ 'include' ] = name
103
+ unless self . has_key? ( :build_config )
104
+ self [ :build_config ] = self . run_config . merge "baseUrl" => source_dir . to_s ,
105
+ "modules" => [ { 'name' => 'application' } ]
106
+ self [ :build_config ] . merge! ( self . user_config ) . slice! ( *self . build_config_whitelist )
107
+ case self . loader
108
+ when :requirejs
109
+ # nothing to do
110
+ when :almond
111
+ mods = self [ :build_config ] [ 'modules' ]
112
+ unless mods . length == 1
113
+ raise Requirejs ::ConfigError , "Almond build requires exactly one module, config has #{ mods . length } ."
114
+ end
115
+ mod = mods [ 0 ]
116
+ name = mod [ 'name' ]
117
+ mod [ 'name' ] = 'almond'
118
+ mod [ 'include' ] = name
119
+ end
118
120
end
119
121
self [ :build_config ]
120
122
end
@@ -131,6 +133,9 @@ def user_config=(cfg)
131
133
if url = cfg . delete ( 'baseUrl' )
132
134
raise Requirejs ::ConfigError , "baseUrl is not needed or permitted in the configuration"
133
135
end
136
+ # delete any cached configs, will be lazily resolved
137
+ self . delete ( :build_config )
138
+ self . delete ( :run_config )
134
139
self [ :user_config ] = cfg
135
140
end
136
141
0 commit comments