Laravel Mix, TailwindCSS, and PurgeCSS - laravel-mix

First time using laravel mix, I'm sure I'm missing something simple.
I have a project where I'm attempting to use Laravel mix to compile tailwindcss and then use purge to remove any unused css.
package.json
"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",
"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"
},
"repository": {
"type": "git",
"url": "git+ssh://*******************.git"
},
"author": "Sean Smith",
"license": "ISC",
"homepage": "**************",
"devDependencies": {
"cross-env": "^5.2.0",
"laravel-mix": "^4.0.16",
"laravel-mix-purgecss": "^4.1.0",
"postcss-easy-import": "^3.0.0",
"postcss-import": "^12.0.1",
"postcss-nested": "^4.1.2",
"postcss-preset-env": "^6.6.0",
"tailwindcss": "^1.0.3"
},
"dependencies": {
"cross-env": "^5.2.0",
"laravel-mix-purgecss": "^4.1.0"
}
}
webpack.mix.js:
// copied from https://gist.github.com/Log1x/8c1d63024cad15cfb05eec495c41a75b
const mix = require('laravel-mix')
require('laravel-mix-purgecss')
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Sage application. By default, we are compiling the Sass file
| for your application, as well as bundling up your JS files.
|
*/
// Public Path
mix.setPublicPath('./public')
// Browsersync
// mix.browserSync('https://example.test')
/**
* Custom PurgeCSS Extractor
* https://github.com/FullHuman/purgecss
* https://github.com/FullHuman/purgecss-webpack-plugin
*/
// Styles
mix.postCss('src/css/styles.css', 'public/assets/css', [
require('postcss-import')(),
require('tailwindcss')('./tailwind.config.js'),
require('postcss-nested')(),
require('postcss-preset-env')(),
]).purgeCss({
enabled: mix.inProduction(),
folders: ['src', 'templates'],
extensions: ['twig','html','js','php', 'vue'],
extractorPattern: [/[a-zA-Z0-9-:_/]+/g],
})
// JavaScript
mix.js('src/js/app.js', 'public/assets/js')
.extract()
// Source maps when not in production.
if (!mix.inProduction()) {
mix.sourceMaps()
}
// Hash and version files in production.
if (mix.inProduction()) {
mix.version()
}
When I run npm run prod everything appears to work correctly. However in the exported styles.css the only styles that are there are from from tailwind/base
styles.css
/* tailwind base; */
#import "tailwindcss/base";
/* tailwind components; */
#import "tailwindcss/components";
/* tailwind utilities; */
#import "tailwindcss/utilities";
/* all shared css here */
#import "./components/shared.css"
None of the classes that are in my templates/index.twig file have been added nor are the styles in ./components/shared.css file.
classes exist in both index.html and shared.css so should not be purged
When I remove purgeCSS the output css file includes everything as expected. However when purge is added in the only output is tailwind/base css.
Please advise.
Here's a screenshot of my directory structure

When you use mix.postCss() or a separate postcss.config.js file, Mix overrides all other PostCSS plugins, including the PurgeCSS instance, added by this plugin.
To work around this issue, include your PostCSS plugins with mix.options()
const mix = require('laravel-mix');
require('laravel-mix-purgecss');
mix.js('resources/js/app.js', 'public/js')
.postCss('resources/css/app.css', 'public/css')
.options({
postCss: [require('tailwindcss')]
})
.purgeCss({
enabled: mix.inProduction(),
});
Refer https://github.com/spatie/laravel-mix-purgecss for more details.

Can you please show us your tailwind.config.js file ?
The file should contain something like that :
module.exports = {
purge: [
'./vendor/laravel/jetstream/**/*.blade.php',
'./storage/framework/views/*.php',
'./resources/views/**/*.blade.php',
],
theme: {
extend: {
lineClamp: {
10 :"10",
12 : "12"
},
fontFamily: {
sans: ['Nunito', ...defaultTheme.fontFamily.sans],
},
},
},
variants: {
extend: {
lineClamp : ["hover"],
opacity: ['disabled'],
},
},
plugins: [require("#tailwindcss/line-clamp"), require('#tailwindcss/forms'), require('#tailwindcss/typography')],
};
purge array should contain the file that you would like to be purged.
purge: [
'./vendor/laravel/jetstream/**/*.blade.php',
'./storage/framework/views/*.php',
'./resources/views/**/*.blade.php',
],
In this exemple above, the command purge will purge the file at the directory /vendor/laravel/jetstream/ and ** mean look at all subfolder under jetstream and finaly the * mean that all file that have .blade.php extension at the jetstream folder and folder should be purged

Related

resolveComponent can only be used in render() or setup()

I'm using laravel nova 4 for creating an admin panel. I'm trying to override a existed nova component. This is what I have done:
Create BelongsToField.vue in resources/js/nova/components/Form, then copy all context in vendor/laravel/nova/resources/js/components/Form/BelongsTo.vue
Add fields.js file in resources/js/nova, this is my file:
import BelongsToField from './components/Form/BelongsToField'
Nova.booting((app, store) => {
app.component('FormBelongsToField', BelongsToField);
})
Then create webpack.mix.js:
const mix = require('laravel-mix');
const path = require('path');
mix.setPublicPath('public')
.js('resources/js/nova/fields.js', 'js')
.vue({ version: 3 });
Then, adding script to NovaServiceProvider
public function boot()
{
parent::boot();
Nova::serving(function (ServingNova $event) {
Nova::script('belongs-to-field', __DIR__ . '/../../public/js/fields.js');
});
}
Because laravel nova 4 uses vite instead of webpack, so I migrate back my application to use s webpack following this (I tried with vite, but it doesn't work, so I change to webpack)
After install all dependencies, this is my package.json file:
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "mix",
"watch": "mix watch",
"watch-poll": "mix watch -- --watch-options-poll=1000",
"hot": "mix watch --hot",
"prod": "npm run production",
"production": "mix --production",
"prepare": "husky install"
},
"devDependencies": {
"#commitlint/cli": "^17.0.3",
"#commitlint/config-conventional": "^17.0.3",
"#vitejs/plugin-vue": "^2.3.3",
"#vue/babel-plugin-jsx": "^1.1.1",
"#vue/compiler-sfc": "^3.2.22",
"axios": "^0.25",
"form-backend-validation": "^2.3.3",
"husky": "^8.0.1",
"laravel-mix": "^6.0.41",
"lodash": "^4.17.21",
"postcss": "^8.3.11",
"vue-loader": "^16.8.3"
},
"dependencies": {
"#inertiajs/inertia": "^0.11.0",
"inflector-js": "^1.0.1",
"vue": "^3.2.37",
"vuex": "^4.0.2"
}
}
Then I run npm run dev to build .js file to public folder, build process succeeded, but component doesn't show up, and Vue displays a warning
I tried to override by using laravel nova custom field and change component field in .php file to belongs-to-field. Vue file context is copied same with origin file in vendor (BelongsToField.vue). After building component, it worked!
Thus, I think my problem not come from component file, it could be from Vue version or webpack config but I'm just new to Vue and cannot debug this error. Can someone help.
For more information: I've used this approach in laravel nova 3, and it worked.

Webpack, Mix and Vuetify loader : SassError: Expected newline

I use Vuetify loader in my Laravel project but compilation doesn't work.
Laravel : 8.46
Vue : 2.6.14
Vuetify : 2.5.3
This is my package.json
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "mix",
"watch": "mix watch",
"watch-poll": "mix watch -- --watch-options-poll=1000",
"hot": "mix watch --hot",
"prod": "npm run production",
"production": "mix --production"
},
"devDependencies": {
"axios": "^0.21",
"deepmerge": "^4.2.2",
"laravel-mix": "^6.0.6",
"path": "^0.12.7",
"postcss": "^8.1.14",
"sass": "^1.34.1",
"sass-loader": "^12.1.0",
"vue": "^2.6.14",
"vue-loader": "^15.9.5",
"vue-template-compiler": "^2.6.14",
"vuetify": "^2.5.3",
"vuetify-loader": "^1.7.2"
}
}
My webpack.mix.js
const mix = require('laravel-mix');
const path = require('path');
const VuetifyLoaderPlugin = require('vuetify-loader/lib/plugin')
mix.webpackConfig({
resolve: {
alias: {
'#': path.resolve(__dirname, 'resources/js/')
}
},
module: {
rules: [
{
test: /\.s(c|a)ss$/,
use: [
"sass-loader",
'vue-style-loader',
'css-loader',
{
loader: 'sass-loader',
options: {
implementation: require('sass'),
sassOptions: {
indentedSyntax: true
},
},
},
],
},
],
},
plugins: [
new VuetifyLoaderPlugin()
],
});
mix.js('resources/js/app.js', 'public/js')
.vue()
//.extract(['vue'])
.postCss('resources/css/app.css', 'public/css', [
//
]);
if (mix.inProduction()) {
mix.version();
}
My entry :
require('./bootstrap');
import Vue from 'vue'
import vuetify from '#/plugins/vuetify'
new Vue({
vuetify,
}).$mount('#app')
And my vuetify plugin :
import Vue from 'vue'
import Vuetify from 'vuetify/lib'
Vue.use(Vuetify)
const opts = {}
export default new Vuetify(opts)
But when I run yarn dev, I have an error :
...
ERROR in ./node_modules/vuetify/src/styles/main.sass (./node_modules/css-loader/dist/cjs.js??clonedRuleSet-15[0].rules[0].use[1]!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-15[0].rules[0].use[2]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-15[0].rules[0].use[3]!./node_modules/sass-loader/dist/cjs.js!./node_modules/vue-style-loader/index.js!./node_modules/css-loader/dist/cjs.js!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-22[0].rules[0].use[3]!./node_modules/vuetify/src/styles/main.sass)
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: Expected newline.
╷
4 │ var content = require("!!../../../css-loader/dist/cjs.js!../../../sass-loader/dist/cjs.js??clonedRuleSet-22[0].rules[0].use[3]!./main.sass");
│ ^
╵
node_modules/vuetify/src/styles/main.sass 4:141 root stylesheet
webpack compiled with 95 errors
I follow Vuetify documentation and Mix documentation.

How to lint SASS/SCSS on Laravel Mix

I have failed to find a solution for this. The only possible outcome I've seen so far is Laravel-Elixir-SCSS-Lint but the current download numbers doesn't indicate me this is the general choice of the public. I did look into the Laravel Mix Extensions page, nothing obvious there either. Never thought there was not going to be a clear option for Laravel Mix having lint SASS/SCSS before with Gulp, Grunt, etc.
Thank you in advance for the help.
Update
After much digging I have come to the following solution, however the linting is not doing a good job and several mistakes are ignored (check console output at the end)
package.json
{
"name": "test",
"version": "1.0.0",
"description": "Description here.",
"main": "index.js",
"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": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"hot": "cross-env NODE_ENV=development webpack-dev-server --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 --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "Me",
"license": "ISC",
"devDependencies": {
"aos": "^2.3.4",
"browser-sync": "^2.26.4",
"browser-sync-webpack-plugin": "^2.0.1",
"cross-env": "^5.2.0",
"laravel-mix": "^4.0.15",
"postcss-reporter": "^6.0.1",
"resolve-url-loader": "^3.1.0",
"sass": "^1.19.0",
"sass-loader": "^7.1.0",
"stylelint": "^10.0.1",
"stylelint-config-recommended": "^2.2.0",
"stylelint-order": "^3.0.0",
"stylelint-scss": "^3.6.0",
"vue-template-compiler": "^2.6.10"
}
}
webpack.mix.js
let mix = require('laravel-mix');
if (!mix.inProduction()) {
mix.webpackConfig({
devtool: 'source-map'
})
.sourceMaps()
}
mix
.copy('libraries/jquery-vide/jquery.vide.min.js', 'dist/js/')
.copy('libraries/headroom/headroom.js', 'dist/js/')
.js('src/js/ab2019.js', 'dist/js/')
.js('src/js/ab2019-vide.js', 'dist/js/')
.sass('src/sass/style.scss', 'dist/css/')
.options({
processCssUrls: false, // Process/optimize relative stylesheet url()'s. Set to false, if you don't want them touched.
postCss:[
require("stylelint")({ /* your options */ }),
require("postcss-reporter")({ clearReportedMessages: true })
]
})
.browserSync({
files: "dist/css/style.css"
})
.setPublicPath('dist');
.stylelintrc.json
{
"extends": "stylelint-config-recommended",
"plugins": [
"stylelint-order",
"stylelint-scss"
],
"rules": {
"block-no-empty": true,
"declaration-colon-space-after": "always",
"indentation": [ 2, {
"message": "Please use 2 spaces for indentation. Tabs make The Architect grumpy.",
"severity": "warning"
} ],
"no-descending-specificity": null,
"order/order": [
"declarations"
],
"order/properties-alphabetical-order": true,
"scss/dollar-variable-colon-space-after": "always-single-line"
}
}
style.scss
$x:1;
.test {
color: white;
background: red
}
.foo {}
a {
}
.bar {
color:#4fd;
padding: 10px 0px;
}
console output
$ npm run dev
> test#1.0.0 dev /fake/path
> npm run development
> test#1.0.0 development /fake/path
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
40% building 7/8 modules 1 active ...e/fake/path/src/sass/style.scss
src/sass/style.scss
32:2 ⚠ Expected background to come before color (order/properties-alphabetical-order) [stylelint]
70% building 9/10 modules 1 active ...e/fake/path/src/sass/style.scss
src/sass/style.scss
32:2 ⚠ Expected background to come before color (order/properties-alphabetical-order) [stylelint]
98% after emitting SizeLimitsPlugin
DONE Compiled successfully in 1489ms
If anyone has this problem I managed to make it work like this.
First I installed:
npm install stylelint stylelint-webpack-plugin --save-dev
Then I added this configuration inside webpack.mix.js file
const StylelintPlugin = require('stylelint-webpack-plugin');
mix.webpackConfig({
...
plugins: [
new StylelintPlugin({ // put your config here
configFile: '.stylelintrc', // path to config file
failOnError: false // don't fail on error
})
]
});
Peace

Laravel Mix and VUE, VUE not found

So I have been getting this NPM error and I cannot figure out why just VUE cannot be resolved. I am using Laravel 5.6. This is a new install of Laravel with some light web pack configuration. I have resolved path in webpackConfig to VUE and I believe it is failing at the extract step in the webpack.mix.js
Vue is installed in node_modules/vue
error is generated using npm run dev and npm run prod
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": {
"#vue/test-utils": "^1.0.0-beta.10",
"axios": "^0.18",
"babel-jest": "^22.1.0",
"bootstrap": "^4.1.3",
"cross-env": "^5.1",
"jquery": "^3.2",
"laravel-mix": "^2.0",
"lodash": "^4.17.5",
"pace": "github:HubSpot/pace#v1.0.2",
"perfect-scrollbar": "^1.4.0",
"popper.js": "^1.14.4",
"simple-line-icons": "^2.4.1",
"sweetalert2": "^7.0.7",
"vue": "^2.5.17"
},
"dependencies": {
"imagemin": "^6.0.0"
}
}
webpack.mix.js
let mix = require('laravel-mix');
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel application. By default, we are compiling the Sass
| file for the application as well as bundling up all the JS files.
|
*/
mix.setPublicPath('public');
/*
|--------------------------------------------------------------------------
| Webpack Config
|--------------------------------------------------------------------------
*/
mix.webpackConfig({
resolve: {
modules: [
path.resolve(__dirname, 'node_modules/bootstrap/dist'),
path.resolve(__dirname, 'node_modules/jquery/dist'),
path.resolve(__dirname, 'node_modules/vue'),
path.resolve(__dirname, 'node_modules/axios/dist'),
path.resolve(__dirname, 'node_modules/lodash'),
path.resolve(__dirname, 'node_modules/sweetalert2/dist'),
path.resolve(__dirname, 'node_modules/popper.js/dist')
]
}
});
/*
|--------------------------------------------------------------------------
| Vendor Extraction
|--------------------------------------------------------------------------
*/
mix.extract([
'vue',
'jquery',
'axios',
'sweetalert2',
'lodash',
'js/bootstrap',
'popper.js'
]);
/*
|--------------------------------------------------------------------------
| Autoload Dependancies
|--------------------------------------------------------------------------
*/
mix.autoload({
jquery: ['$', 'window.jQuery', 'jQuery']
});
/*
|--------------------------------------------------------------------------
| Mix App Resources
|--------------------------------------------------------------------------
| app.js | Application Javascript file
| app.scss | Applciation SCSS file
*/
mix
.js(['resources/js/app.js'], 'public/js')
.sass('resources/sass/app.scss', 'public/css');
/*
|--------------------------------------------------------------------------
| Mix In Production
|--------------------------------------------------------------------------
*/
if (mix.inProduction() || process.env.npm_lifecycle_event !== 'hot') {
mix.version();
}
NPM Error
ERROR in multi vue jquery axios sweetalert2 lodash js/bootstrap popper.js
Module not found: Error: Can't resolve 'vue' in '/Path/To/Project/Project-Folder'
# multi vue jquery axios sweetalert2 lodash js/bootstrap popper.js
app.js
/**
* First we will load all of this project's JavaScript dependencies which
* includes Vue and other libraries. It is a great starting point when
* building robust, powerful web applications using Vue and Laravel.
*/
require('./bootstrap');
window.Vue = require('vue');
/**
* Next, we will create a fresh Vue application instance and attach it to
* the page. Then, you may begin adding components to this application
* or customize the JavaScript scaffolding to fit your unique needs.
*/
Vue.component('example-component', require('./components/ExampleComponent.vue'));
const app = new Vue({
el: '#app'
});
In your webpack.mix file you have the following line:
path.resolve(__dirname, 'node_modules/vue'),
Just make sure that this is correct, It maybe that you need to target a dist folder or similar e.g.
path.resolve(__dirname, 'node_modules/vue/dist'),

Webpack can't find (font) dependencies

NPM/Webpack can't find dependencies with Laravel Mix
These dependencies were not found:
* font-awesome
* ionicons
ERROR in multi lodash jquery bootstrap-sass fastclick jquery-slimscroll admin-lte icheck ionicons font-awesome datatables.net datatables.net-bs
Module not found: Error: Can't resolve 'font-awesome' in 'D:\Laragon'
# multi lodash jquery bootstrap-sass fastclick jquery-slimscroll admin-lte icheck ionicons font-awesome datatables.net datatables.net-bs
More clearly. These are installed (can find them in node_modules) and require location is correct. I'm also using more packages, and these problems are related to, coincidentally, the only fonts in my webpack.
They are available in the package.json and package.json.lock.
Installed trying different methods: firstly npm install and --save-dev, also tried yarn install and yarn add.
My webpack.mix.js:
let mix = require('laravel-mix');
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel application. By default, we are compiling the Sass
| file for the application as well as bundling up all the JS files.
|
*/
mix.webpackConfig({
module: {
loaders: [
{
test: /\.js?/,
exclude: [/node_modules/, /styles/],
loaders: ['babel'],
include: path.join(__dirname, 'src')
},
{
test: /\.scss$/,
loader: 'style!css!resolve-url!sass?sourceMap'
},
{
test: /\.css$/,
loader: "style-loader!css-loader"
},
{
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'url-loader?limit=10000&mimetype=application/font-woff'
},
{
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'file-loader'
}
]
}
});
mix.js('resources/assets/js/app.js', 'public/js')
.sass('resources/assets/sass/app.scss', 'public/css');
mix.js('resources/assets/js/auth.js', 'public/js')
.sass('resources/assets/sass/auth.scss', 'public/css');
mix.js('resources/assets/js/admin-lte.js', 'public/js')
.sass('resources/assets/sass/admin-lte.scss', 'public/css');
mix.autoload({
jquery: [ '$', 'jQuery', 'jquery'],
DataTable: 'datatables.net-bs'
});
mix.extract([
'lodash', 'jquery', 'bootstrap-sass',
'fastclick', 'jquery-slimscroll', 'admin-lte',
'icheck', 'ionicons', 'font-awesome',
'datatables.net', 'datatables.net-bs'
], 'public/js/vendor.js');
mix.version();
I also tried it without the mix.webpackConfig, adding the config this was a desperate attempt to fix the fonts.
Here is my 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": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"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": {
"admin-lte": "^2.4.2",
"axios": "^0.17",
"bootstrap": "^4.0.0",
"cross-env": "^5.1.3",
"datatables.net": "^1.10.16",
"fastclick": "^1.0.6",
"font-awesome": "^4.7.0",
"icheck": "^1.0.2",
"ionicons": "^3.0.0",
"jquery": "^3.3.1",
"jquery-slimscroll": "^1.3.8",
"laravel-mix": "^2.0",
"lodash": "^4.17.4",
"popper.js": "^1.12",
"script-loader": "^0.7.2"
},
"dependencies": {
"bootstrap-sass": "^3.3.7",
"datatables.net-bs": "^1.10.16"
}
}
And in my .scss:
#import '~font-awesome/scss/font-awesome';
Both on Mac and Windows 10
Include Font Awesome into your NPM config
"devDependencies": {
......
......
"font-awesome": "^4.7.0"
}
Run npm update
And then your app.scss include this
// Font Awesome
#import "~font-awesome/scss/font-awesome.scss";
Run npm dev or `npm watch
Getting rid of font-awesome and ionicons from the extract function solves the problem.

Resources