Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

I tried your config and it works, resulting html has prefetch and preload links. I myself have config which preloads fonts and prefetches js and css and it works. Perhaps something else doesn't work in yout case. Are you using version 2? #35

Open
caiziran opened this issue Feb 4, 2023 · 1 comment

Comments

@caiziran
Copy link

caiziran commented Feb 4, 2023

          I tried your config and it works, resulting html has prefetch and preload links. I myself have config which preloads fonts and prefetches js and css and it works. Perhaps something else doesn't work in yout case. Are you using version 2?
     new PreloadWebpackPlugin({
        rel: 'preload',
        as(entry) {
          if (/\.(woff(2)?)(\?v=[0-9]\.[0-9]\.[0-9])?$/.test(entry)) {
            return 'font';
          }
        },
        fileWhitelist: [/\.(woff(2)?)(\?v=[0-9]\.[0-9]\.[0-9])?$/],
        include: 'allAssets'
      }),
      new PreloadWebpackPlugin({
        rel: 'prefetch',
      }),

Originally posted by @lkarmelo in #22 (comment)

@caiziran
Copy link
Author

caiziran commented Feb 4, 2023

different type of resource can use type to divide. when same type of resource are used in our project ,how to divide?
`
import(/* webpackPreload: true */'./abc1.js')
.then(({ default: s} ) => console.log(s))

import(/* webpackPrefetch: true */ './abc2.js')
.then(({ default: s} ) => console.log(s))
`

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant