Git Product home page Git Product logo

Comments (7)

alexander-akait avatar alexander-akait commented on June 30, 2024 1

/cc @sokra

from webpack-sources.

sokra avatar sokra commented on June 30, 2024 1

ConcatSource optimizes children internally after adding items. So removing might sometimes won't work as expected.

Anyway Sources are intended to be immutable after initial generation. remove doesn't fit good into the design.

Avoid adding items at first place. You can use an array to construct the items and add them to the ConcatSource after done.

from webpack-sources.

alexander-akait avatar alexander-akait commented on June 30, 2024

What do you mean, please clarify

from webpack-sources.

lh0x00 avatar lh0x00 commented on June 30, 2024

@evilebottnawi because I see ConcactSource have children is an array, when I want to remove an item from list but a must-do manual. If we support add method I think we support remove method too.

from webpack-sources.

alexander-akait avatar alexander-akait commented on June 30, 2024

@lamhieu-vk can you provide example of code, thanks

from webpack-sources.

lh0x00 avatar lh0x00 commented on June 30, 2024

@evilebottnawi for example, in plugin A do something and set assets is a ConcactSource have children like

const asset = ConcactSource {
  children: [
    'code1 - is a header comment', 
    'code2', 
    'code3 - is a source map',
  ],
}

in my plugin, I want to have a way to remove children in ConcactSource from plugin A return, for example:

 // remove comment header
asset.remove(0);

// or remove source map
asset.remove(2);

from webpack-sources.

lh0x00 avatar lh0x00 commented on June 30, 2024

@sokra can you tell me anything?

from webpack-sources.

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.