Use webpack.LoaderOptionsPlugin may not be a good idea.
Because webpack.LoaderOptionsPlugin may change the loader's context.For example, when i use css-loader to generate css-module code, at this time loader-utils will use this.context to generate style's hash loader-utils#L265.So when i use webpack multi entries to build an universal-react app,
This problem may lead to generate different css-hash(because i use transform-loader only in the client entry), it might be header__logo___1WE56 and header__logo__2USE
Breaking Changes
So we should use loader.options to avoid this problem. I add a new option index to assign the current transform, used like:
This PR contains a:
Motivation / Use-Case
Use
webpack.LoaderOptionsPlugin
may not be a good idea.Because
webpack.LoaderOptionsPlugin
may change the loader's context.For example, when i usecss-loader
to generate css-module code, at this timeloader-utils
will usethis.context
to generate style's hash loader-utils#L265.So when i use webpack multi entries to build an universal-react app, This problem may lead to generate different css-hash(because i usetransform-loader
only in the client entry), it might beheader__logo___1WE56
andheader__logo__2USE
Breaking Changes
So we should use
loader.options
to avoid this problem. I add a new optionindex
to assign the current transform, used like:Additional Info
It's just an idea, if you think it will be ok, i will update the README later.😃