Answer the question
In order to leave comments, you need to log in
How to compile sass files into separate folder in webpack?
Good afternoon! I just can’t figure out how to compile sass files and put them in the dist
folder
This is how my webpack.config looks like for now
const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const PATHS = {
source: path.join(__dirname, './app'),
build: path.join(__dirname, './dist')
};
module.exports = {
devtool: 'source-map',
context: PATHS.source,
entry: PATHS.source + '/js/app.js',
output: {
path: PATHS.build,
filename: 'js/build.js'
},
devServer: {
contentBase: PATHS.build,
compress: true,
historyApiFallback: {
index: 'index.html',
hot: true
}
},
module: {
rules: [
{
test: /\.js$/,
exclude: [/node_modules/],
use: [
{
loader: 'babel-loader',
options: {
presets: ['es2015']
}
}
]
},
{
test: /\.(sass|scss)$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
'css-loader',
'sass-loader'
]
})
}
]
}
};
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question