-
-
Save jorgedavila25/73e6c1d631a78e2f5c33300da808f0f9 to your computer and use it in GitHub Desktop.
This file contains 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 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