Stack Exchange
Laravel Mix is adding Moment.js code into CSS
Laravel mix is adding moment JS code into CSS files. So, run npm prod is resulting to an error:

CssSyntaxError: Missed semicolon.

I imported Moment.js into one of Vue component.
This is my package JSON:
"devDependencies": {
    "axios": "^0.19",
    "compass-mixins": "^0.12.10",
    "cross-env": "^5.1",
    "css-loader": "^3.2.0",
    "laravel-mix": "^4.0.7",
    "lodash": "^4.17.13",
    "resolve-url-loader": "^2.3.1",
    "sass": "^1.15.2",
    "sass-loader": "^7.1.0",
    "vue": "^2.5.17",
    "vue-router": "^3.1.2",
    "vue-template-compiler": "^2.6.10"
},
"dependencies": {
    "bootstrap-vue": "^2.0.0-rc.28",
    "vue-lodash": "^2.0.2",
    "vue-material-design-icons": "^3.3.1",
    "vue2-daterange-picker": "^0.3.1"
}

This is the webpack.mix.js file:
mix
.sass("resources/sass/admin/app.scss", "public/admin/css")
.js("resources/js/admin/app.js", "public/admin/js");

And this is the part of inserted JS code in compiled CSS after I run npm run watch:
var map = {
"./af": "./node_modules/moment/locale/af.js",
"./af.js": "./node_modules/moment/locale/af.js",
"./ar": "./node_modules/moment/locale/ar.js",
"./ar-dz": "./node_modules/moment/locale/ar-dz.js"}

It is weird, why this happen?

I switched from moment.js to date-fns

You need to add the following plugin:
plugins: [
    new webpack.IgnorePlugin({
        resourceRegExp: /^\.\/locale$/,
        contextRegExp: /moment$/
    }),
]

Don't forget to import webpack:
const webpack = require('webpack');

