rspack
rspack copied to clipboard
[Feature]: Support native ESM loader
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 */
}
This is on our roadmap. Stay tuned ;-) You may use .mjs wrapper for now.
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!
@h-a-n-a is it fixed now?
@h-a-n-a is it fixed now?
Not yet supported