@@ -142,7 +142,8 @@ impl<'a> Context<'a> {
142
142
OutputMode :: Bundler { .. }
143
143
| OutputMode :: Node {
144
144
experimental_modules : true ,
145
- } => {
145
+ }
146
+ | OutputMode :: Web => {
146
147
if contents. starts_with ( "function" ) {
147
148
let body = & contents[ 8 ..] ;
148
149
if export_name == definition_name {
@@ -161,50 +162,6 @@ impl<'a> Context<'a> {
161
162
format ! ( "export const {} = {};\n " , export_name, contents)
162
163
}
163
164
}
164
- OutputMode :: Web => {
165
- // In web mode there's no need to export the internals of
166
- // wasm-bindgen as we're not using the module itself as the
167
- // import object but rather the `__exports` map we'll be
168
- // initializing below.
169
- let export = if export_name. starts_with ( "__wbindgen" )
170
- || export_name. starts_with ( "__wbg_" )
171
- || export_name. starts_with ( "__widl_" )
172
- {
173
- ""
174
- } else {
175
- "export "
176
- } ;
177
- if contents. starts_with ( "function" ) {
178
- let body = & contents[ 8 ..] ;
179
- if export_name == definition_name {
180
- format ! (
181
- "{}function {name}{}\n __exports.{name} = {name}" ,
182
- export,
183
- body,
184
- name = export_name,
185
- )
186
- } else {
187
- format ! (
188
- "{}function {defname}{}\n __exports.{name} = {defname}" ,
189
- export,
190
- body,
191
- name = export_name,
192
- defname = definition_name,
193
- )
194
- }
195
- } else if contents. starts_with ( "class" ) {
196
- assert_eq ! ( export_name, definition_name) ;
197
- format ! ( "{}{}\n " , export, contents)
198
- } else {
199
- assert_eq ! ( export_name, definition_name) ;
200
- format ! (
201
- "{}const {name} = {};\n __exports.{name} = {name};" ,
202
- export,
203
- contents,
204
- name = export_name
205
- )
206
- }
207
- }
208
165
} ;
209
166
self . global ( & global) ;
210
167
Ok ( ( ) )
@@ -366,7 +323,6 @@ impl<'a> Context<'a> {
366
323
// expose the same initialization function as `--target no-modules`
367
324
// as the default export of the module.
368
325
OutputMode :: Web => {
369
- self . imports_post . push_str ( "const __exports = {};\n " ) ;
370
326
self . imports_post . push_str ( "let wasm;\n " ) ;
371
327
init = self . gen_init ( needs_manual_start) ;
372
328
footer. push_str ( "export default init;\n " ) ;
0 commit comments