Skip to content

Commit b0dc772

Browse files
committed
fix: fix onRequire file path
1 parent e30ae5e commit b0dc772

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

spec/bundler.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ test('Bundler supports implementation returned by onRequire', t => {
452452
{contents: 'dumber-module-loader;'},
453453
{contents: 'define.switchToUserSpace();'},
454454
{path: 'src/app.js', contents: "define('app',[\"foo\"],1);", sourceMap: undefined},
455-
{path: '__on_require__/foo', contents: "define('foo',[\"loo\"],1);", sourceMap: undefined},
455+
{path: '__on_require__/foo.js', contents: "define('foo',[\"loo\"],1);", sourceMap: undefined},
456456
{contents: 'define.switchToPackageSpace();'},
457457
{path: 'node_modules/loo/loo.js', contents: "define('loo/loo',[],1);define('loo',['loo/loo'],function(m){return m;});", sourceMap: undefined},
458458
{contents: 'define.switchToUserSpace();'},

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ export default class Bundler {
260260
// got full content of this module
261261
if (typeof result === 'string') {
262262
return this.capture({
263-
path: '__on_require__/' + parsedId.bareId,
263+
path: '__on_require__/' + parsedId.bareId + (parsedId.ext ? '' : '.js'),
264264
contents: result,
265265
moduleId: parsedId.bareId
266266
});

0 commit comments

Comments
 (0)