Skip to content

Instantly share code, notes, and snippets.

@wpflames
Created February 7, 2022 15:40
Show Gist options
  • Select an option

  • Save wpflames/cd3cc70e3be397d865db362dfe86e1d4 to your computer and use it in GitHub Desktop.

Select an option

Save wpflames/cd3cc70e3be397d865db362dfe86e1d4 to your computer and use it in GitHub Desktop.
Webpack with SASS Loader
const path = require('path');
module.exports = {
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
entry: [
__dirname + '/assets/js/app.js',
__dirname + '/assets/sass/style.scss'
],
output: {
path: path.resolve(__dirname, 'assets'),
filename: 'build/script.min.js',
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: [],
}, {
test: /\.scss$/,
exclude: /node_modules/,
type: 'asset/resource',
generator: {
filename: 'build/style.min.css'
},
use: [
'sass-loader'
]
}
]
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment