Created
September 15, 2018 13:15
-
-
Save squalvj/32748da041851841c39bd12010e108f4 to your computer and use it in GitHub Desktop.
Webpack config for SASS + Babel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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