Skip to content

[Feature] allow copy files before and after webpack build #195

@factoidforrest

Description

@factoidforrest

My entry point is inside the directory that has been copied. This plugin seems to use the webpack file emit at the end to output the files. Is there a way to do this sooner? Or to somehow target an entrypoint inside the copied directory?

Activity

michael-ciniawsky

michael-ciniawsky commented on Dec 18, 2017

@michael-ciniawsky
Member
cp src/* dist/* && webpack

Sry, this plugin is an integration of cp for webpack during runs, there is no way to start/use a webpack plugin without actually starting webpack

factoidforrest

factoidforrest commented on Dec 18, 2017

@factoidforrest
Author

But you could hook into the compilation process before entrypoints are resolved. I ended up doing it like this:

const EventHooksPlugin = require('event-hooks-webpack-plugin');
const fs = require('fs-extra')

//in webpack plugins
      new EventHooksPlugin({
        'before-run': (compilation, done) => {
          console.log('Copying source files to compiled')
          fs.copy('src', 'compiled', done);
        }
      }),
added this to the 4.4.0 milestone on Dec 18, 2017
michael-ciniawsky

michael-ciniawsky commented on Dec 18, 2017

@michael-ciniawsky
Member

Sry, I overread entrypoints :), (maybe) possible, but not supported atm

stereokai

stereokai commented on Mar 22, 2018

@stereokai

@light24bulbs Thank you, your comment helped out a lot!

changed the title [-]Is there a way to make the copy happen before webpack loads the entry points?[/-] [+][Feature] allow copy files before and after webpack build[/+] on Feb 18, 2019
removed this from the 4.6.0 milestone on Feb 18, 2019
appsparkler

appsparkler commented on Mar 26, 2019

@appsparkler

@evilebottnawi

It would be nice to have an option like event (either in options or pattern config) which will decide when the copy is executed.

alexander-akait

alexander-akait commented on Mar 26, 2019

@alexander-akait
Member

PR welcome

rburnham52

rburnham52 commented on May 3, 2019

@rburnham52
Qvatra

Qvatra commented on Jun 28, 2021

@Qvatra
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @factoidforrest@rburnham52@stereokai@alexander-akait@michael-ciniawsky

        Issue actions

          [Feature] allow copy files before and after webpack build · Issue #195 · webpack-contrib/copy-webpack-plugin