question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Webpack combining order issues

See original GitHub issue
  • Laravel Mix Version: 0.8.1
  • Node Version: v6.5.0
  • NPM Version: 3.10.3
  • OS: Windows 10

Description:

I seem to be have some strange issues with the compile order of my requires and imports in app.scss and app.js.

They look like this: app.scss

// Variables
@import "variables";

// Imports
@import "~bootstrap-sass/assets/stylesheets/bootstrap";
@import "~admin-lte/dist/css/AdminLTE.css";
@import "~admin-lte/dist/css/skins/_all-skins.css";
@import "~font-awesome/scss/font-awesome.scss";
@import "~jquery-form-validator/src/theme-default.css";
@import "~simplemde/dist/simplemde.min.css";
// Custom
@import "custom";

app.js

require('./bootstrap.js');

require('admin-lte/dist/js/app.js');
require('jquery-form-validator/form-validator/jquery.form-validator.js');
require('jquery-form-validator/form-validator/security.js');`

Webpack looks like this:

mix.js('resources/assets/js/app.js', 'public/js')
    .sass('resources/assets/sass/app.scss', 'public/css')
    .sourceMaps();`

However, the order of the combined files are not how they are required or imported. For example, the AdminLTE styles is loaded in before the Bootstrap styles. Last inserted is Fontawesome, second to last is Bootstrap styles. In the middle of it all I have my Custom, which is imported lastly in the app.scss - hard to make custom changes, if they aren’t combined in the right order.

So what is wrong? Do webpack combine them in a specific order? Gulp did combine in the order of imports and requires.

Steps To Reproduce:

  1. Install fresh laravel
  2. Import NPM components as described above
  3. Insert them in app.js and app.scss
  4. Run npm run dev
  5. Check browser for the ordering.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:21

github_iconTop GitHub Comments

9reactions
danielcommessecommented, Jan 21, 2018

This is still an issue which makes Laravel Mix unusable… Has anyone find a fix?

Node Version: v8.9.4 NPM Version: 5.6.0 OS: Ubuntu 16.04

7reactions
medelasricommented, Sep 26, 2017

Please update this!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Webpack combining order issues · Issue #429 · laravel-mix ...
I seem to be have some strange issues with the compile order of my requires and imports in app.scss and app.js. ... However,...
Read more >
Webpack 2 is not compiling files in the right order
In the js file that uses Bootstrap. I ran into this issue when using another js library that depended on jQuery, which I...
Read more >
Code Splitting - webpack
This feature allows you to split your code into various bundles which can then be loaded on demand or in parallel. It can...
Read more >
Build Performance - webpack
This guide contains some useful tips for improving build/compilation performance. General. The following best practices should help, whether you're running ...
Read more >
Entry Points - webpack
... reused and combined with other partial configurations. This is a popular technique used to separate concerns by environment, build target, and runtime....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found