erikgall / envoyer-npm-deployment

Compile assets that depend on node packages using Laravel Envoyer deployment hooks
47 stars 3 forks source link

Can't get this to work, any recent changes? #3

Closed jordonbaade closed 7 years ago

jordonbaade commented 7 years ago

~It fails to copy the package.json to the expected location for hook #1 but has a status code of 0 - thanks for any suggestions or hep you can offer!~

This was user error, coworker spun up new dev server I was looking at old, for the most part it works fine, had further issues below.

jordonbaade commented 7 years ago

I'm using Laravel 5.4 with Mix under Spark 4. it was looking for many of the modules in the wrong area (the {{project}} directory where package.json is copied to in the deployment hook).

I had to copy the webpack.config.js file from Mix to the project root and change:

Mix.initialize();

to

Mix.initialize('./');

I also had to change my webpack.mix.js file to look from the same directory into the /current symlink so it could find my modules in /resources/assets/js

if ( mix.config.inProduction ) {
    mix.disableNotifications()
        .js('./current/resources/assets/js/app.js', 'public/js')
        .extract(extract)
        .less('resources/assets/less/app.less', 'public/css')
        .version();
} else {
    mix.js('resources/assets/js/app.js', 'public/js')
        .extract(extract)
        .less('resources/assets/less/app.less', 'public/css')
        .sourceMaps()
        .browserSync('uproar.dev');
}

I am however now stuck with one compile error left: image

jordonbaade commented 7 years ago

When I remove my modifications to Mix.initialize() I get an error like this:

image

Others have suggested it's looking for the app.less and can't find it, and my css is being compiled fine, so I think they're reading the error wrong. When I compare with the error above and the app.js shown below it's clearly saying it can't find the dependency for the requires in the app.js file.

image

erikgall commented 7 years ago

Solved..

jordonbaade commented 7 years ago

Thanks for the help @erikgall!

Issue was not having deployment hooks in the right spot, and needing to overwrite Mix.initialize like I did. I had to revert the other path changes I had made in the screenshots.