Skip to content

Instantly share code, notes, and snippets.

@squalvj
Created September 15, 2018 13:15
Show Gist options
  • Save squalvj/32748da041851841c39bd12010e108f4 to your computer and use it in GitHub Desktop.
Save squalvj/32748da041851841c39bd12010e108f4 to your computer and use it in GitHub Desktop.
Webpack config for SASS + Babel
const path = require('path');
module.exports = {
entry: './assets/js/dev/index.js',
output: {
filename: 'bundle.js',
// __dirname is a function that npm itself have in the library
path: path.resolve(__dirname, './assets/js/dist')
},
module: {
rules: [
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}
},
{
test: /\.sass$/,
use: [
"style-loader", // creates style nodes from JS strings
"css-loader", // translates CSS into CommonJS
"sass-loader" // compiles Sass to CSS, using Node Sass by default
]
}
]
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment