Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bundler comments out require.resolve call despite of module marked as external #8636

Closed
shameleo opened this issue Jan 16, 2019 · 2 comments
Closed
Labels

Comments

@shameleo
Copy link

Bug report

What is the current behavior?
Bundler removes require.resolve, even when module is external

If the current behavior is a bug, please provide the steps to reproduce.
Webpack config:

module.exports = {
    mode: 'development',
    target: 'node',
    entry: './entry.js',
    externals: function(context, request, callback) {
		if (/^\.\/dep-dynamic$/.test(request)){
			return callback(null, 'commonjs ' + request);
		}
		callback();
	},
    output: {
        filename: 'bundle.js',
    }
};

entry.js

const depDynamic = require('./dep-dynamic');
console.log(JSON.stringify(depDynamic));

const depDynamicPath = require.resolve('./dep-dynamic');
console.log(depDynamicPath);

dep-dynamic.js
module.exports = "doesn't matter";

What is the expected behavior?
If module remains external then require.resolve invocation must be left in bundle in order to return absolute path to this module

Other relevant information:
webpack version: 4.28.4
Node.js version: 8.9.4

@webpack-bot
Copy link
Contributor

This issue had no activity for at least half a year.

It's subject to automatic issue closing if there is no activity in the next 15 days.

@webpack-bot
Copy link
Contributor

Issue was closed because of inactivity.

If you think this is still a valid issue, please file a new issue with additional information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants