Giter Club home page Giter Club logo

Comments (8)

limichange avatar limichange commented on June 3, 2024 1

This would be useful for avoiding sourcemaps - maybe you could pass in a blacklist of regexes/globs to match against? It could be populated with ['*.map'] for a start to stop the plugin including sourcemaps.

This is useful. We don't want to preload sourcemap.

from preload-webpack-plugin.

jackfranklin avatar jackfranklin commented on June 3, 2024 1

I opened a PR with the blacklist feature: #16

If anyone needs it for now you can always depend on my version of this repo.

from preload-webpack-plugin.

addyosmani avatar addyosmani commented on June 3, 2024

I think that's a valid ask. You're proposing using a similar API to how html-webpack-plugin tackles this I assume? :)

from preload-webpack-plugin.

mooyoul avatar mooyoul commented on June 3, 2024

Yeah that's correct. I just want to include/exclude some named chunks on preload-webpack-plugin like html-webpack-plugin :)

FYI, previously i was used below snippet (quick & dirty solution) for implementing preload chunks with filtering on my html-webpack-plugin html template file:

    <%
      Object.keys(webpack.assetsByChunkName)
        .filter((k) => k && k.indexOf('CHUNK_NAME_TO_BE_IGNORED') === -1)
        .reduce((collection, k) => collection.concat(webpack.assetsByChunkName[k]), [])
        .filter((filename) => filename && filename.slice(-3) === '.js')
        .forEach((filename) => {
    %>
    <link rel="preload" href="<%= webpackConfig.output.publicPath %><%= filename %>" as="script">
    <%  }); %>

from preload-webpack-plugin.

jantimon avatar jantimon commented on June 3, 2024

The best way would be to use the chunks from htmlPluginData which gives you the setting for each generated page as you can use multiple html-webpack-plugin instances https://github.com/GoogleChrome/preload-webpack-plugin/blob/7760ef791605c05cd306c0f63ce9b6d6318a2c7c/index.js#L36

from preload-webpack-plugin.

ingro avatar ingro commented on June 3, 2024

This option would be very useful! I wanted to exclude sourcemap's chunks but it seems not possible at the moment...

from preload-webpack-plugin.

jackfranklin avatar jackfranklin commented on June 3, 2024

This would be useful for avoiding sourcemaps - maybe you could pass in a blacklist of regexes/globs to match against? It could be populated with ['*.map'] for a start to stop the plugin including sourcemaps.

from preload-webpack-plugin.

jackfranklin avatar jackfranklin commented on June 3, 2024

@addyosmani I'm happy to attempt a PR if you're happy with that approach, or to talk through it.

from preload-webpack-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.