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

Support for ECMAScript loader (with "type": "module") #13233

Closed
tschaub opened this issue Apr 26, 2021 · 9 comments · Fixed by #15198
Closed

Support for ECMAScript loader (with "type": "module") #13233

tschaub opened this issue Apr 26, 2021 · 9 comments · Fixed by #15198

Comments

@tschaub
Copy link
Contributor

tschaub commented Apr 26, 2021

Feature request

What is the expected behavior?

If a loader is authored as an ECMAScript module (or if the nearest package.json has "type": "module"), it would be nice if webpack provided the necessary info to loader-runner so that the loader could be loaded.

What is motivation or use case for adding/changing the behavior?

It looks like loader-runner supports loaders authored with ESM (see webpack/loader-runner#40). I'm assuming that means that webpack will eventually support ESM loaders. I'm opening this issue to get confirmation on that or to hear if anybody has looked into it.

How should this be implemented in your opinion?

If a loader's package.json has "type": "module", webpack should set the loader.type to module for loader-runner.

Are you willing to work on this yourself?

Sure (with guidance).

@sokra
Copy link
Member

sokra commented Apr 27, 2021

Yep good idea to continue on that. You need to look into the NormalModuleFactory in webpack. It resolves an array of loaders in some method and creates the argument that is later passed to loader-runner. The resolver will provide you the information from package.json and you need to include that as type for the loader-runner argument.

@webpack-bot
Copy link
Contributor

This issue had no activity for at least three months.

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

@alexander-akait
Copy link
Member

Bump

@stefanprobst
Copy link
Contributor

hi, in your comment in #13233 (comment) did you mean this:

main...stefanprobst:fix/pass-package-type-to-loader-runner

@otakustay
Copy link

@stefanprobst I tested your patch in some of my projects and everything works fine, maybe you are interested in creating a PR for this, desperately waiting for that

@stefanprobst
Copy link
Contributor

stefanprobst commented Jan 18, 2022

@otakustay cool, thanks for testing! i opened #15198 to get some maintainer feedback!

@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.

@fregante
Copy link

fregante commented May 4, 2023

Can the bot be updated to avoid stuff like this? A maintainer reopened it, it should stay open. This causes a lot of noise in the issue and in notifications 😔

Screenshot 1

@alexander-akait
Copy link
Member

Yeah, we will fix it soon, just need some time

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