You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey guys, I wanted to ask about the reasoning behind using a path for NS variable, instead of something static, like a string.
Heres the issue, lets say i have a build toolchain. The toolchain contains an import to mini-css, then elsewhere in the project core i also import mini-css.
What happens is i get an error saying this[NS] cant be resolved. When logging i discover that each instance has a new name which is used for loader context.
So the loader is looking for this[‘plugin-sass/node_modules/extract’], but the plugin is providing this[‘react-static/node_modules/extract']
I can change this by hard coding a string, and everything works perfectly across the instances.
const NS = '_extractCssChunks'; // works perfectly
Id like to know if there is any particular reason it was coded in this manner?
if i were to change the NS to something static in my project, would there any ramifications?
sokra [08:15] yep, I also thought about changing this to i. e. css/mini-extract. This would also work better with the new module type filters in splitChunks
If you want to give it a try feel free to send a PR :)
Awesome, im currently implementing this into extract-css-chunks-webpack-plugin, which was based of mini-css. Im testing this with some assistance from the React Static team.
Seems stable but want to wait for a couple thousand downloads before I make any changes here.
Hey guys, I wanted to ask about the reasoning behind using a path for NS variable, instead of something static, like a string.
Heres the issue, lets say i have a build toolchain. The toolchain contains an import to mini-css, then elsewhere in the project core i also import mini-css.
What happens is i get an error saying this[NS] cant be resolved. When logging i discover that each instance has a new name which is used for loader context.
So the loader is looking for
this[‘plugin-sass/node_modules/extract’]
, but the plugin is providingthis[‘react-static/node_modules/extract']
I can change this by hard coding a string, and everything works perfectly across the instances.
const NS = '_extractCssChunks'; // works perfectly
Id like to know if there is any particular reason it was coded in this manner?
if i were to change the
NS
to something static in my project, would there any ramifications?mini-css-extract-plugin/src/index.js
Line 13 in 6323e17
Appreciate your work and time.
@sokra
The text was updated successfully, but these errors were encountered: