preload-webpack-plugin icon indicating copy to clipboard operation
preload-webpack-plugin copied to clipboard

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?

Open caiziran opened this issue 3 years ago • 1 comments

          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 https://github.com/vuejs/preload-webpack-plugin/issues/22#issuecomment-898909275

caiziran avatar Feb 04 '23 16:02 caiziran

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)) `

caiziran avatar Feb 04 '23 17:02 caiziran