Skip to content

๐Ÿ™‹ Incremental bundling on new filesย #754

@nextlogic-ono

Description

@nextlogic-ono

๐Ÿ™‹ feature request

Parcel only recompiles the files that got changed but if I add a new file, apparently it does not get detected but is there a way for parcel to monitor for new files when 'import' statement matches the criteria? (Currently, I'm using an external process 'onchange' to detect for new files.)

For example, if I have,

import './style/*.css'

and 'style' directory has 'a.css' and 'b.css', they get compiled upon modification but if I add 'c.css' into it, parcel obviously cannot detect it as it was never imported on launch and an external mechanism is required for this to be bundled but is this possible for parcel to implement such detection?

๐Ÿค” Expected Behavior

Bundle the newly added file incrementally if it matches 'import' matching criteria.

๐Ÿ˜ฏ Current Behavior

Newly added file is ignored.

๐Ÿ’ Possible Solution

Current possible solution is to use another daemon such as 'onchange' to detect for new file addition (but do not restart on file modification as parcel picks it up for incremental bundling by using --filter option for 'onchange') and restart parcel through it but this is slow as the entire bundle has to be rebuilt.

If this is going to be implemented internally, it should listen for 'add' and 'unlink' events coming from chokidar (or any file system monitoring package that can do similar.) and initiate the incremental bundling process.

๐Ÿ’ป Code Sample

It can currently be achieved by the following combination, but with a heavy restart on file addition and deletion.

onchange 'style/**' --initial --filter add,unlink parcel watch app.js
touch style/c.css
rm style/c.css

๐ŸŒ Your Environment

Software Version(s)
Parcel 1.5.1
Node 8.9.4
npm/Yarn 5.6.0
Operating System Ubuntu 16.04

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      โšก