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

[Feature]: Support import asset in bundleless mode #217

Closed
Timeless0911 opened this issue Sep 18, 2024 · 0 comments · Fixed by #221
Closed

[Feature]: Support import asset in bundleless mode #217

Timeless0911 opened this issue Sep 18, 2024 · 0 comments · Fixed by #221

Comments

@Timeless0911
Copy link
Contributor

Timeless0911 commented Sep 18, 2024

What problem does this feature solve?

We only deals js externsion in externals when in bundleless mode.

externals: [
(data: any, callback: any) => {
// Issuer is not empty string when the module is imported by another module.
// Prevent from externalizing entry modules here.
if (data.contextInfo.issuer) {
// Node.js ECMAScript module loader does no extension searching.
// Add a file extension according to autoExtension config
// when data.request is a relative path and do not have an extension.
// If data.request already have an extension, we replace it with new extension
// This may result in a change in semantics,
// user should use copy to keep origin file or use another separate entry to deal this
let request = data.request;
if (request[0] === '.') {
request = extname(request)
? request.replace(/\.[^.]+$/, jsExtension)
: `${request}${jsExtension}`;
}
return callback(null, request);
}
callback();
},
],

image

What does the proposed API look like?

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

Successfully merging a pull request may close this issue.

1 participant