-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] CLI flag to specify action to run after bundling finishes #800
Comments
Does the script need a reference to current bundle/bundler, as currently with |
|
With a javascript file, parameters could be passed as it is currently the case with plugins (along the lines of |
I'd say a string so to give maximum flexibility |
I'm not sure if this should be a feature? |
In agreement with @DeMoorJasper here. The API gives you the flexibility to tap into the // setup Bundler
const bundler = new Bundler(main, command);
// attach events
bundler.on('buildEnd', () => {
// run post-build scripts
})
bundler.bundle(); // or bundler.serve(); |
Seems reasonable to use the API for this I think. We should probably document it so people know they can do that though! :) Also, this won't work for development, but for build scripts you can just chain the commands: Curious what your usecase is for this though. Can you provide some context? |
@devongovett I am including the @brandon93s code snippet seems ok but I do agree that this should be documented. |
The events of the bundler should really be documented. What is the difference between |
The
|
Looks like we have consensus... there’s no real need for this feature at this point. Sorry @microcipcip but I’m gonna close this issue, but let us know if you need help accomplishing this using the |
Just FYI. I've been developing a server with Node and Typescript, and I needed to re-build the app and restart it on every file change. That's how I got here. Anyway, I've solved it with Nodemon. Here's how: nodemon --exec 'parcel build src/server.ts --bundle-node-modules && node dist/server.js' -e ts --watch src In other words, Nodemon watches |
The proper solution for this is described in #935 |
As @microcipcip pointed out, Parcel doesn’t have any easy way to run a script after bundling finishes. So if you want to call some script that further processes the bundled files after they get bundled, there’s no easy way to do that from the CLI if you are running parcel in watch mode.
Implementation seems pretty straightforward but I wanted to get some feedback from the community before going ahead and implementing it.
Some Questions / Discussion Points
--postbundle
?--then
?parcel entry.abc --then script.js
but might not be intuitive to everyoneparcel entry.abc -x script.js
parcel entry.abc -x ‘node script.js’
parcel entry.abc -x ‘python somescript.py’
So ya, would love to get feedback from you guys on what you think about this and any thoughts you guys have on the things above.
The text was updated successfully, but these errors were encountered: