Skip to content
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

Add onBeforeBuild #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

antonioribeiro
Copy link

Implementing webpack's invalid.

I needed this because I'm running an external script, to compile some files using PHP, and generating a .js file which should be then processed by webpack. Using onBuildStart did not fired it the way I thought it would, before webpack start to build things, and onBuildExit, saves the file after everything is done, firing a new webpack watch event, which results in a loop. The real problem was that, even when I had it updated at some point (yes it kind of worked without this), it was too late for LiveReload to catch the update files.

This is the use case:

const LiveReloadPlugin = require('webpack-livereload-plugin');
const WebpackShellPlugin = require('webpack-shell-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');

mix.webpackConfig({
    plugins: [
        new LiveReloadPlugin(),

        new CopyWebpackPlugin([
            { from: 'resources/lang', to: '/tmp/resources/lang' },
        ], {
            copyUnmodified: true
        }),

        new WebpackShellPlugin({
            onBeforeBuild:['php artisan app:build-localization-json'],
        }),
    ]
});

CopyWebpackPlugin is responsible for watching those external files and triggering the change event during watch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant