portfolio/webpack.config.js
2022-06-21 12:33:35 +02:00

53 lines
No EOL
1.1 KiB
JavaScript
Executable file

const path = require('path')
const GlobImporter = require('node-sass-glob-importer')
const TerserPlugin = require("terser-webpack-plugin")
const isDev = process.env.NODE_ENV === 'development'
module.exports = {
mode: isDev ? 'development' : 'production',
watch: isDev,
devtool: isDev ? 'cheap-module-source-map' : 'source-map',
entry: [
'./assets/scripts/main.js',
'./assets/styles/main.scss'
],
output: {
path: path.resolve(__dirname, './public/dist/'),
filename: 'app.min.js',
},
module: {
rules: [{
test: /\.(scss)/,
use: [{
loader: "file-loader",
options: {
outputPath: './',
name: 'app.min.css'
}
},
{
loader: 'sass-loader',
options: {
sourceMap: true,
sassOptions: {
importer: GlobImporter(),
outputStyle: "compressed"
}
}
}
]
}]
},
plugins: [],
optimization: {
minimize: true,
minimizer: [
new TerserPlugin()
]
}
}