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

Incorrect handling of esModule option #475

Closed
dangreen opened this issue Aug 5, 2020 · 6 comments
Closed

Incorrect handling of esModule option #475

dangreen opened this issue Aug 5, 2020 · 6 comments

Comments

@dangreen
Copy link
Contributor

dangreen commented Aug 5, 2020

https://github.com/webpack-contrib/style-loader/blob/master/src/index.js#L30

delete options.esModule;

https://github.com/webpack/loader-utils/blob/master/lib/getOptions.js

loaderUtils.getOptions doesn't copy options, just returns original object (loaderContext.query).

esModule option will be removed after first loader call, so farther calls will produce commonjs exports.

It breaks require imports:

require('./default.lazyModule.scss').default // undefined

Reproduction of this bug can be unstable, I think it caused by webpack's internal optimizations.

@alexander-akait
Copy link
Member

Please use the issue template in future

@dangreen
Copy link
Contributor Author

dangreen commented Aug 5, 2020

I think I can make PR with fix.

@alexander-akait
Copy link
Member

Fixed in the master

@dangreen
Copy link
Contributor Author

dangreen commented Aug 5, 2020

@evilebottnawi How soon release with this fix will published?

@alexander-akait
Copy link
Member

I hope near future, we want to do mini-css-extract-plugin and style-loader releases together (set esModule: true), otherwise it can create problems for developers

@dangreen
Copy link
Contributor Author

dangreen commented Aug 5, 2020

👌

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

No branches or pull requests

2 participants