Skip to content

Instantly share code, notes, and snippets.

@Ch4s3
Created December 4, 2016 23:36
Show Gist options
  • Save Ch4s3/19e528ca7c412ec7a44dee8286c42921 to your computer and use it in GitHub Desktop.
Save Ch4s3/19e528ca7c412ec7a44dee8286c42921 to your computer and use it in GitHub Desktop.
"use strict";
const path = require("path");
const webpack = require("webpack");
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const ClosureCompiler = require("google-closure-compiler-js").webpack;
module.exports = {
context: __dirname + "/source",
entry: {
site: "./javascripts/all.js",
},
module: {
rules: [
{
test: /\.js$/,
use: [{
loader: "babel-loader",
options: { presets: ["es2015"] }
}],
},
{
test: /\.(sass|scss)$/,
use: [{
loader: ExtractTextPlugin.extract({
fallbackLoader: ["style-loader"],
loader: [
{
loader: "css-loader",
options: { minimize: true, },
},
{
loader: "sass-loader",
options: { outputStyle: "compressed", },
},
],
}), //end ExtractTextPlugin loader
}],
},
],//end rules
},
output: {
path: __dirname + "/build/javascripts",
filename: "[name].bundle.js",
},
plugins: [
new ExtractTextPlugin({
filename: "../stylesheets/[name].bundle.css",
allChunks: true,
}),
new ClosureCompiler({
options: {
processCommonJsModules: true,
createSourceMap: true,
languageIn: "ECMASCRIPT6",
languageOut: "ECMASCRIPT5",
compilationLevel: "ADVANCED",
warningLevel: "QUIET",
},
})
],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment