@@ -162,8 +162,7 @@ export function esbuildDepPlugin(
162
162
const flatId = flattenId ( id )
163
163
if ( flatId in qualified ) {
164
164
return {
165
- path : flatId ,
166
- namespace : 'dep'
165
+ path : qualified [ flatId ]
167
166
}
168
167
}
169
168
}
@@ -179,7 +178,7 @@ export function esbuildDepPlugin(
179
178
}
180
179
181
180
// ensure esbuild uses our resolved entries
182
- let entry : { path : string ; namespace : string } | undefined
181
+ let entry : { path : string } | undefined
183
182
// if this is an entry, return entry namespace resolve result
184
183
if ( ! importer ) {
185
184
if ( ( entry = resolveEntry ( id ) ) ) return entry
@@ -198,48 +197,6 @@ export function esbuildDepPlugin(
198
197
}
199
198
)
200
199
201
- // For entry files, we'll read it ourselves and construct a proxy module
202
- // to retain the entry's raw id instead of file path so that esbuild
203
- // outputs desired output file structure.
204
- // It is necessary to do the re-exporting to separate the virtual proxy
205
- // module from the actual module since the actual module may get
206
- // referenced via relative imports - if we don't separate the proxy and
207
- // the actual module, esbuild will create duplicated copies of the same
208
- // module!
209
- const root = path . resolve ( config . root )
210
- build . onLoad ( { filter : / .* / , namespace : 'dep' } , ( { path : id } ) => {
211
- const entryFile = qualified [ id ]
212
-
213
- let relativePath = normalizePath ( path . relative ( root , entryFile ) )
214
- if (
215
- ! relativePath . startsWith ( './' ) &&
216
- ! relativePath . startsWith ( '../' ) &&
217
- relativePath !== '.'
218
- ) {
219
- relativePath = `./${ relativePath } `
220
- }
221
-
222
- let contents = ''
223
- const { hasImports, exports, hasReExports } = exportsData [ id ]
224
- if ( ! hasImports && ! exports . length ) {
225
- // cjs
226
- contents += `export default require("${ relativePath } ");`
227
- } else {
228
- if ( exports . includes ( 'default' ) ) {
229
- contents += `import d from "${ relativePath } ";export default d;`
230
- }
231
- if ( hasReExports || exports . length > 1 || exports [ 0 ] !== 'default' ) {
232
- contents += `\nexport * from "${ relativePath } "`
233
- }
234
- }
235
-
236
- return {
237
- loader : 'js' ,
238
- contents,
239
- resolveDir : root
240
- }
241
- } )
242
-
243
200
build . onLoad (
244
201
{ filter : / .* / , namespace : 'browser-external' } ,
245
202
( { path } ) => {
0 commit comments