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

Url loader docs example not working #1158

Closed
navied opened this issue Jan 5, 2018 · 1 comment
Closed

Url loader docs example not working #1158

navied opened this issue Jan 5, 2018 · 1 comment

Comments

@navied
Copy link

navied commented Jan 5, 2018

The url loader example in the docs here:

https://github.com/rails/webpacker/blob/master/docs/webpack.md#url-loader

Is not working anymore due to the removal of assetHost from #1107

What would be the proper replacement with the new webpacker version?

@gauravtiwari
Copy link
Member

Yeah the documentation needs updating. You don't need to specify publicPath.

// config/webpack/loaders/url.js

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

// config/webpack/environment.js

const { environment } = require('@rails/webpacker')

environment.loaders.prepend('url', url)

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

No branches or pull requests

2 participants