Rahul's avatar
Level 1

After minifying my JS is not working !

Hi, When i run my laravel elixir gulp --production it minifying my js files with webpack but why it's not working after that :( any idea ?

0 likes
5 replies
willvincent's avatar

Any error messages? You'll really need to provide more info than just "it doesn't work" for anyone to have any chance of helping you.

Rahul's avatar
Level 1

No , there is no error message, it's juts not working . Let me explain you in little more. when i'm working with gulp everything is working great. but when use gulp --production it's shows this in console.

vagrant@homestead:~/sites/codecourse$ gulp --production
[18:57:43] Using gulpfile ~/sites/codecourse/gulpfile.js
[18:57:43] Starting 'all'...
[18:57:43] Starting 'sass'...
[18:57:45] Finished 'sass' after 1.61 s
[18:57:45] Starting 'webpack'...
[18:57:48]
[18:57:48] Finished 'webpack' after 2.8 s
[18:57:48] Finished 'all' after 4.41 s
[18:57:48] Starting 'default'...
┌───────────────┬───────────────────────────────┬──────────────────────────────────┬──────────────────────┐
│ Task          │ Summary                       │ Source Files                     │ Destination          │
├───────────────┼───────────────────────────────┼──────────────────────────────────┼──────────────────────┤
│ mix.sass()    │ 1. Compiling Sass             │ resources/assets/sass/app.scss   │ ./public/css/app.css │
│               │ 2. Autoprefixing CSS          │                                  │                      │
│               │ 3. Concatenating Files        │                                  │                      │
│               │ 4. Applying Minification      │                                  │                      │
│               │ 5. Saving to Destination      │                                  │                      │
├───────────────┼───────────────────────────────┼──────────────────────────────────┼──────────────────────┤
│ mix.webpack() │ 1. Transforming ES2015 to ES5 │ resources/assets/js/**/*.ctrl.js │ ./public/js/hello.js │
│               │ 2. Writing Source Maps        │                                  │                      │
│               │ 3. Applying Minification      │                                  │                      │
│               │ 4. Saving to Destination      │                                  │                      │
└───────────────┴───────────────────────────────┴──────────────────────────────────┴──────────────────────┘
[18:57:48] Finished 'default' after 11 ms
vagrant@homestead:~/sites/codecourse$

and after that it's minified my all files but when i use that file nothing is happening. i'm logging something to the console but i can't see them. little strange but it's true.

my gulpfile , actually i'm just testing it.

elixir(function(mix) {
    mix.sass('app.scss','./public/css/app.css')
        .webpack(['**/*.ctrl.js'], './public/js/hello.js');
});

whats wrong ?

Rahul's avatar
Rahul
OP
Best Answer
Level 1

Oh shitt, i got it why it's happening . actually i'm trying to log some messages into browser console so normally it's working fine but when i run gulp --production it's actually automatically stripped out all the console.log from my javascript. that's why i can't see that in console after building production. howvere an alert will do the trick because at production alert will not strip out automatically . actually i didn't knew it before , yesterday i learned about webpack so not i recall that. :)

2 likes
Sukhrob's avatar

hey Rahul, i am having the same issue. after compiling js files my app is not functioning. PLEASE HELP ME brother.

Tray2's avatar

@sukhrob Open a new thread with your issue instead of highjacking a three year old thread that has already been solved.

1 like

Please or to participate in this conversation.