Skip to content
This repository has been archived by the owner on Jan 21, 2021. It is now read-only.

preload not worked as expected #89

Open
tr1s opened this issue Jan 29, 2019 · 1 comment
Open

preload not worked as expected #89

tr1s opened this issue Jan 29, 2019 · 1 comment

Comments

@tr1s
Copy link

tr1s commented Jan 29, 2019

I'm using the beta, so that fixed my cb is not a function problem, but now nothing will append.

I've tried putting it after the HtmlWebpackPlugin and after the ScriptExtHtmlWebpackPlugin plugins and neither worked. I also tried

plugins: [
  new HtmlWebpackPlugin(),
  new PreloadWebpackPlugin({
    rel: 'preload',
    as(entry) {
      if (/\.css$/.test(entry)) return 'style';
      if (/\.woff$/.test(entry)) return 'font';
      if (/\.png$/.test(entry)) return 'image';
      return 'script';
    }
  })
]

as well as...

plugins: [
  new HtmlWebpackPlugin(),
  new PreloadWebpackPlugin()
]

but nothing seems to work.

@timothyvanderaerden you helped me before with the beta issue. Is there any chance you can test my webpack-boilerplate and see if it's working for you? or perhaps see what I'm doing wrong?

Thank you, let me know. I'd like to get this working for my CSS file and woff2/woff links that are being injected.

@timothyvanderaerden
Copy link

This is more of a question then a bug which is discussed here: #55. I opened a pull request in your project with the suggested changes.

For reference to anyone landing on this thread, if you want to use preload for something that is resolved using file-loader. You should include allAssets.

    new PreloadWebpackPlugin({
      rel: 'preload',
      include: 'allAssets'
    }),

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

No branches or pull requests

2 participants