Skip to content

Instantly share code, notes, and snippets.

@jorgedavila25
Created May 2, 2018 20:40
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 jorgedavila25/73e6c1d631a78e2f5c33300da808f0f9 to your computer and use it in GitHub Desktop.
Save jorgedavila25/73e6c1d631a78e2f5c33300da808f0f9 to your computer and use it in GitHub Desktop.
'use strict';
const webpack = require('webpack');
const path = require('path');
const ClosurePlugin = require('closure-webpack-plugin');
module.exports = (env) => {
const isProduction = env === 'production';
const compilerFlags = isProduction
? {
angular_pass: true,
compilation_level: 'WHITESPACE_ONLY',
warning_level: 'QUIET'
}
: {
formatting: 'PRETTY_PRINT',
angular_pass: true,
debug: true
};
return {
entry: {
app: './src/app.js',
},
output: {
path: path.resolve(__dirname, 'public'),
filename: 'app.js'
},
devServer: {
contentBase: path.resolve(__dirname, 'public'),
},
module: {
rules: [
{
test: /\.html$/,
use: 'raw-loader',
exclude: [/node_modules/]
}
]
},
plugins: [
new ClosurePlugin(
{
mode: isProduction ? 'STANDARD' : 'NONE',
closureLibraryBase: require.resolve('google-closure-library/closure/goog/base'),
deps: [
require.resolve('google-closure-library/closure/goog/deps'),
'./public/deps.js',
],
},
compilerFlags
)
]
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment