-
-
Notifications
You must be signed in to change notification settings - Fork 209
feat: recognise config.options.map (options.sourceMap)
#286
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
Conversation
|
@michael-ciniawsky What do your think about this? Should we prioritize loader options over config? |
|
This is not prioritizing loader options over config. Loader options are already extended by config here: This PR is just making sure that we can enable source map from config. Although I think loader options should have higher priority, considering changing this might include a big breaking change, I'm not gonna suggest you to change current logic. |
|
The reason I avoided this is that in a normal setup you need to enable |
config.options.map (options.sourceMap)
|
This also needs a (separate) test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs tests and a safeguard to ensure config.options.map is consistent with the two sourcemap options currently possible for webpack setups ( true|'inline')
Since neither true nor inline exists as bare PostCSS Options directly, which postcss.config.js needs to support without any abstraction to be consitent across all postcss runners (CLI, Gulp, webpack), there needs to be a safeguard ensuring both ways of configuration behave exactly the same.
I'm not sure if I understand this correctly: Because postcss-loader only support |
|
What I'm confusing about here is postcss-loader prioritize some options from config files but ignore some other options from them at all. I have to configure in both places and be aware of the details under the hood if I want to put things into config files. |
Yeah agreed, it is in one way or the other not optimal, but the standard way for webpack.config.js (No [
{ loader: 'style-loader', options: { sourceMap: true } },
{ loader: 'css-loadder', options: { sourceMap: true } },
{ loader: 'postcss-loader', options: { sourceMap: true } },
{ loader: 'sass-loader', options: { sourceMap: true } }
]webpack.config.js (with [
{ loader: 'style-loader', options: { sourceMap: true } },
{ loader: 'css-loadder', options: { sourceMap: true } },
'postcss-loader', // <= "Inconsistent" for options.sourceMap (as the point of view)
{ loader: 'sass-loader', options: { sourceMap: true } }
]Since |
|
Thanks for the explanation. So rather than changing current behavior, I think we'd better clarify this in the docs to prevent confusion like "I've configured source maps in my config file, why do postcss-loader still giving warnings?". |
|
@Justineo I gave this some though and this two paths are possible
|
|
@michael-ciniawsky |
Currently loader options can be overridden by config options loaded by postcss-load-config.
So we should use the merged
options.maphere instead ofsourceMap.