-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
beta23 doesn't start if config object includes loader configs because of schema #3018
Comments
Well, can be worked around by moving the options into the loader object... Not sure if this should be closed, leaving it to maintainers. |
@princemaple Yes, we just dropped this today, and I've been working furiously on a blogpost, and guide. Easiest migration steps for custom loader properties in config.
|
That is also a solution as well. |
See #2974 (comment) |
Thanks! I think this is a good move! On Tue, 20 Sep 2016, 12:47 Sean Larkin notifications@github.com wrote:
|
Is there an option to disable validation? |
That's a shame you introduced this breaking change with no easy way to handle it. I think your best shot here is to accept real JS in loader query options. Currently if you pass JS (a function or a regex), you do not get any warnings. Your stuff magically disappear! (Unless you changed this behavior?) We need to do something and saying to people to use a plugin in addition to the loader seriously sucks. Like a lot. Is there any real reason query object only accept json? I guess it's a legacy thing due to the string limitation, but I think it's seriously time to reconsider this. |
There is an |
@MoOx I hear you are a bit upset about this breaking change. Let me explain it. The real problem was that loader query doesn't accept any object but only JSON. But some loaders needed plugins. This resulted in a workaround for loader. They took options from webpack configuration. I didn't really like it, because this means there are two ways of passing options to a loader. But as there was no other way it was fine for me. beta.23 now adds support for any object as loader query. This means you can now pass your loader plugins via the options/query parameter to the loader. With most loaders this will work out of the box as they merged query object with options from configuration. But technically this could require a change in the loader. Because of this the "old" of passing options to the loader is still possible. beta.23 also adds a schema validation to the configuration. For this we also disallow custom properties in the configuration. Elsewise you won't get a hint for typos (i. e. I try to document this change in the webpack 1 migration guide. We not trying to break your stuff, just trying to make it more clear and easy. But this requires some breaking changes... |
I understand why it was how it was.
Ok this makes me un-upset. I am not used to see release notes for webpack releases so I missed that.
Totally agree. Thanks for you explanations. |
@sokra I understand what you're trying to do, but preventing people from running webpack at all because of their existence is silly. Looking at the original PR it looks like people were in agreement that this should be a warning at best until there is proper time for people to update their configs. In my own opinion, forcing people to correct schema changes when the webpack build successfully ran before without issues is the opposite of a good user experience. |
@Akkuma we decided in the end that it was a justifiable tradeoff. I will publish a short migration guide if this will assist you also. |
@Akkuma you need to see this change in the context of webpack 1 to webpack 2 migration. Here a proper validation is more valuable as you need the modify the configuration anyway. It doesn't prevent you from running webpack, it just requires a 4 line change. The validation tells you what's wrong. For the webpack 2 release you'll have a complete upgrade guide where this is all explained in detail. Until then using webpack 2 beta is a bit bleeding edge. If using you should stay up-to-date with the webpack development. And... give us a day or two to sort out all the stuff regarding breaking changes. They (hopefully) will eventually have positive implications for webpack 2. |
My webpack broke from inconsequential properties existing on it. Literally, removing them didn't impact my build before or after the update to beta23, so I don't see how breaking something that had no impact on my build is a positive or justifiable tradeoff. I would have greatly appreciated being told I had useless properties sitting in my config as warnings. I did not appreciate it when it killed my build. |
I'm seeing this same thing. Breaks postcss.
Even though webpack-validator says it's fine. |
@kevinSuttle please refer to #3018 (comment) |
I'd just like to point out to everyone that this is a beta version of the software and as a beta version it is still in heavy development, as such breaking changes should be expected. If this is going to cause problems for you in your development life cycle then you really should be using the previous stable version or if you absolutely have to have the latest then lock down your version to a previously known working implementation when issues like this arise. |
@TheLarkInn the solution based on LoaderOptionsPlugin is breaking stuff for css-loader (eg: [path] is missing in localIdentName and [hash] is a global one, so some CSS supposed to be "modules" become global with the same name, so 💥). Unusable in my case. |
How about:
|
@MoOx the css-loader does not even use options in configuration. So it should not be affected of these change. You should not even need to change the configuration for the css-loader. Could you add your configuration? @hustcer https://github.com/webpack/webpack.js.org/blob/develop/content/how-to/upgrade-from-webpack-1.md#resolveroot-resolvefallback-resolvemodulesdirectories |
Was 2.0 ever released? |
.. changed everything as @hustcer said and now i have troubles with resolve-url-loader (1.6.0)
hm, what else i need to change?? cause i got:
|
For people who came here looking for the solution of how to fix:
with the error of:
Just change your webpack.config.js to:
Also, this page is very helpful: |
Would you consider leaving |
A little hack to solve my issue with resolve-url-loader is #issuecomment-249522569 here |
@sokra but what is correct way to access this options object from plugin? |
this.query is an object when an object is passed. loader-utils parseQuery normalizes this. |
@sokra Just tested on master. import cssNext from 'postcss-cssnext'
...
options: {
plugins: [cssNext()]
}
Maybe it will be better to provide access to "honest" javascript object? webpack can merge string options to object options before passing it to plugin so plugin will no need to call |
Hm sorry look like problem was in concrete use case. I found very strange bug. If |
@hustcer your solution saved me a lot of work and stress (and I already spend a few of), thank you so much! |
@farwayer yep that's a bug. Could you open a separate issue? |
@sokra is this issue in loader-utils or in core itself? I could try and take a stab at fixing this. |
@TheLarkInn bug is in core #3136 |
Hi,
Please provide me some solution for the same |
Still getting the following error:
under
|
Having an empty extensions string ( If you remove the empty string value in your extensions array, that error should go away. |
Thanks @narthollis that helped with that specific error i was having. |
I'm submitting a bug report
Webpack version:
2.1.0-beta.23
Please tell us about your environment:
Windows 10
Current behavior:
Expected/desired behavior:
Schema should handle loader configurations, maybe?
The text was updated successfully, but these errors were encountered: