portfolio/webpack.config.js

53 lines
1.1 KiB
JavaScript
Raw Normal View History

2022-06-21 10:33:35 +00:00
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()
]
}
}