-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[docs] Document the /es folder #10888
Conversation
Note that #10857 is being closed not because
|
I actually use the |
@dantman webpack is popular, why not. |
Actually I'm not great at writing documentation. Writing can be difficult for me. I just wanted to note that I use the following in my WebPack config: resolve: {
alias: {
// Load ECMAScript 6+/module variants of packages
lodash: 'lodash-es',
'material-ui': 'material-ui/es',
'material-ui/styles': 'material-ui/es/styles',
'material-ui-icons': 'material-ui-icons/es',
},
}, You can see the aliases for material-ui and material-ui-icons. I also alias material-ui/styles because I import it for now until #10858 is handled. Doing it this way makes it so you don't need to explicitly write Although I suppose there is a chance that a 3rd party library could still try and |
@dantman Most third party libraries do It's also the approach we document in all the demos. The react-router approach is interesting, but I what does it provide that the current approach doesn't? |
Ok, then if I start using them I'm going to have to come up with an alternative configuration that rewrites the whole path based on a pattern instead of just aliasing individual modules. |
I'm trying out this plugin config in WebPack instead of using // Force imports of packages like material-ui and material-ui-icons to use the /es versions
new webpack.NormalModuleReplacementPlugin(
/^(material-ui|material-ui-icons)(\/|$)/,
resource => {
resource.request = resource.request.replace(
/^([^/+]+)(?:\/es)?(\/.*)?$/,
'$1/es$2'
);
}
), |
Document and make the
/es
folder official as requested by @dantman.Closes #10857, I believe the root of the problem is to find in webpack side. Ideally, I would have tried with Rollup to see if that works.