Skip to content

Instantly share code, notes, and snippets.

@zilahir
Last active December 30, 2018 22:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zilahir/935b4ce53580340be7020225cd13d03c to your computer and use it in GitHub Desktop.
Save zilahir/935b4ce53580340be7020225cd13d03c to your computer and use it in GitHub Desktop.
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