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 native ESM loader #5735

Closed
colinaaa opened this issue Feb 21, 2024 · 4 comments · Fixed by #6753
Closed

[Feature]: Support native ESM loader #5735

colinaaa opened this issue Feb 21, 2024 · 4 comments · Fixed by #6753
Labels
feat New feature or request

Comments

@colinaaa
Copy link
Contributor

What problem does this feature solve?

This allows using a native ESM loader loader.js with "type": "module" in package.json (which webpack supports, see: https://github.com/webpack/webpack/tree/main/test/cases/loaders/_esm-loader-type).

Use case

I'm developing a rspack plugin with loader and "type": "module" in package.json. I have to run cp lib/loader.js lib/loader.mjs after every build to make it work with rspack. And the tsc --watch I used to build the whole project cannot do that for me(it also does not support output .mjs files).

What does the proposed API of configuration look like?

// loader.js
/** @type {import('webpack').LoaderDefinitionFunction} */
export default function loader() {
  return /** content */
}

Pitching loader:

// loader.js
/** @type {import('webpack').PitchLoaderDefinitionFunction} */
export const pitch = function() {
  return /** content */
}
@colinaaa colinaaa added feat New feature or request pending triage The issue/PR is currently untouched. labels Feb 21, 2024
@h-a-n-a h-a-n-a removed the pending triage The issue/PR is currently untouched. label Feb 22, 2024
@h-a-n-a
Copy link
Collaborator

h-a-n-a commented Feb 22, 2024

This is on our roadmap. Stay tuned ;-) You may use .mjs wrapper for now.

Copy link

stale bot commented Apr 22, 2024

This issue has been automatically marked as stale because it has not had recent activity. If this issue is still affecting you, please leave any comment (for example, "bump"). We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

@stale stale bot added the stale label Apr 22, 2024
@hardfist
Copy link
Contributor

@h-a-n-a is it fixed now?

@stale stale bot removed the stale label Apr 22, 2024
@h-a-n-a
Copy link
Collaborator

h-a-n-a commented Apr 22, 2024

@h-a-n-a is it fixed now?

Not yet supported

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

Successfully merging a pull request may close this issue.

3 participants