Instantly share code, notes, and snippets.

Embed
What would you like to do?
webpack config
const path = require("path");
module.exports = {
resolve: {
alias: {
'node_modules': path.join(__dirname, 'node_modules'),
}
},
entry: {
"common" : "./js/site.js",
"style": path.join(__dirname, 'scss', 'style.scss'),
},
output: {
path: path.resolve(__dirname, "../dist/js"),
filename: "[name].js",
publicPath: "./../dist"
},
module: {
rules: [
{
test: /\.js$/,
use: {
loader: "babel-loader",
options: {
presets: ['@babel/preset-env']
}
}
},
{
test: /\.scss$/,
use: [
{
loader: 'file-loader',
options: {
name: './../css/style.css',
}
},
{
loader: 'extract-loader'
},
{
loader: 'css-loader?-url'
},
{
loader: 'postcss-loader',
options: {
plugins: () => [require('autoprefixer')]
}
},
{
loader: 'sass-loader'
}
]
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment