Created
April 11, 2017 02:13
-
-
Save Ch4s3/cdb399bf439bc85ce9b735e005b66686 to your computer and use it in GitHub Desktop.
demo webpack config for https://chase.pursu.es/webpack-2-and-middleman-4.html
This file contains hidden or 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
"use strict"; | |
const path = require("path"); | |
const webpack = require("webpack"); | |
const ExtractTextPlugin = require("extract-text-webpack-plugin"); | |
const cssLoaders = [ | |
{ | |
loader: "css-loader", | |
options: { | |
modules: true, | |
minimize: true | |
} | |
}, | |
{ | |
loader: "sass-loader" | |
} | |
] | |
module.exports = { | |
context: __dirname + "/source", | |
entry: { | |
site: "./javascripts/site.js", | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /\.js$/, | |
exclude: /(node_modules)/, | |
loader: "babel-loader", | |
}, | |
{ | |
test: /\.(sass|scss)$/, | |
use: ExtractTextPlugin.extract({ | |
fallback: "style-loader", | |
use: "css-loader" | |
}) | |
}, | |
],//end rules | |
}, | |
output: { | |
path: __dirname + "/build/javascripts", | |
filename: "[name].bundle.js", | |
}, | |
plugins: [ | |
new webpack.LoaderOptionsPlugin({ | |
minimize: true, | |
debug: false | |
}), | |
new ExtractTextPlugin({ | |
filename: (getPath) => { | |
return getPath("[name].bundle.css").replace("css/js", "css"); | |
}, | |
disable: false, | |
allChunks: true, | |
}), | |
], | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment