dimanche 21 juillet 2019

Webpack generating empty CSS files in Laravel app

I have a Laravel application that uses webpack to compile some SASS assets.

const mix = require('laravel-mix');

mix.sass('resources/sass/app.scss', 'public/css')
    .sass('resources/sass/layouts.scss', 'public/css');

package.json:

{
    "private": true,
    "scripts": {
        "dev": "npm run development",
        "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
        "watch": "npm run development -- --watch",
        "watch-poll": "npm run watch -- --watch-poll",
        "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
        "prod": "npm run production",
        "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
    },
    "devDependencies": {
        "@babel/plugin-syntax-dynamic-import": "^7.2.0",
        "bootstrap": "^4.3.1",
        "cross-env": "^5.1",
        "google-maps-api-loader": "^1.1.1",
        "jquery": "^3.4.1",
        "laravel-mix": "^4.0.16",
        "lodash": "^4.17.5",
        "popper.js": "^1.15.0",
        "resolve-url-loader": "^2.3.2",
        "sass": "^1.22.1",
        "sass-loader": "^7.1.0",
        "vue": "^2.6.10",
        "vue-router": "^3.0.6",
        "vue-template-compiler": "^2.6.10",
        "vuetify": "^1.5.16"
    },
    "dependencies": {
        "ajv": "^6.10.0",
        "axios": "^0.18.0",
        "laravel-echo": "^1.5.4",
        "less": "^3.9.0",
        "less-loader": "^4.1.0",
        "moment": "^2.24.0",
        "npm": "^6.10.0",
        "socket.io-client": "^2.2.0",
        "vue-axios": "^2.1.4",
        "vue-instantsearch": "^1.7.0",
        "vue2-filters": "^0.6.0",
        "vue2-google-maps": "^0.10.6"
    }
}

When I run npm run dev, the output says that the CSS files are generated properly.

 DONE  Compiled successfully in 3177ms                                                                                                                                                                   3:16:42 PM

           Asset      Size  Chunks             Chunk Names
    /css/app.css   196 KiB     mix  [emitted]  mix
/css/layouts.css  9.91 KiB     mix  [emitted]  mix

However when I check the .css files, both of them are empty. Why?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire