Skip to content
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

[Migrate] loaders transform: should options be always grouped with the loader #159

Closed
okonet opened this issue May 23, 2017 · 8 comments · Fixed by #308
Closed

[Migrate] loaders transform: should options be always grouped with the loader #159

okonet opened this issue May 23, 2017 · 8 comments · Fixed by #308

Comments

@okonet
Copy link
Contributor

okonet commented May 23, 2017

Do you want to request a feature or report a bug?
Bug/Question?

What is the current behavior?

This:

     {
        test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
        loader: 'url-loader',
        options: {
          limit: 10000,
          name: 'static/media/[name].[hash:8].[ext]'
        }
      },

will be converted to this:

      {
        test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
        use: [{
          loader: 'url-loader'
        }],
        options: {
          limit: 10000,
          name: 'static/media/[name].[hash:8].[ext]'
        }
      },

Question is: is this correct result or should options be grouped with the loader?

cc @sokra

@okonet okonet changed the title [Migrate] [Migrate] loaders transform: should options be always grouped with the loader May 23, 2017
@evenstensberg
Copy link
Member

Any status update on this?

@pksjce
Copy link

pksjce commented Jun 21, 2017

@okonet - Can options be bound to multiple loaders? Isn't it more clearer to group them with the loaders?

@okonet
Copy link
Contributor Author

okonet commented Jun 21, 2017

Can options be bound to multiple loaders?

I don't know! That's why I've created this issue.

@schmuli
Copy link

schmuli commented Jun 25, 2017

According to the webpack TypeScript definition files, a UseRule (i.e. a rule with a use property) can not have an options property.

So you either need to continue using a LoaderRule (i.e. loader and options properties, or you need to specify the options in the use property, either as an object or as an array.

@okonet
Copy link
Contributor Author

okonet commented Jun 25, 2017

Thanks @schmuli! I'll need to update code to make this happen.

@evenstensberg
Copy link
Member

@okonet @pksjce any of you guys got time to do this?

@sendilkumarn
Copy link
Member

I will take a crack at this, the out put should be something like this right ?

{
        test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
        use: [{
          loader: 'url-loader'
        },
        options: {
          limit: 10000,
          name: 'static/media/[name].[hash:8].[ext]'
        }]
      },

@evenstensberg
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants