Skip to content

Instantly share code, notes, and snippets.

@CurtisHumphrey
Created April 5, 2016 19:32
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 CurtisHumphrey/9c5dfe4852fd58dde5f6b289fb86d131 to your computer and use it in GitHub Desktop.
Save CurtisHumphrey/9c5dfe4852fd58dde5f6b289fb86d131 to your computer and use it in GitHub Desktop.
getsentry switching projects
<!-- the normal html -->
<%= htmlWebpackPlugin.options.raven %>
</body>
</html>
<script src="https://cdn.ravenjs.com/2.3.0/raven.min.js"></script>
<script>
var prod_host = 'main.com'
var prod_path = 'https://##@app.getsentry.com/##'
var stage_path = 'https://##@app.getsentry.com/##'
var path = (window.location.host === prod_host) ? prod_path : stage_path;
Raven.config(path).install()
</script>
const childProcess = require('child_process')
const VERSION = childProcess.execSync('git describe --tags').toString()
const raven_stage = 'https://###@app.getsentry.com/###'
const raven_prod = 'https://###@app.getsentry.com/###'
const prod_host = 'main.com'
let raven
if (__PROD__) {
debug('Adding Raven for production or stage')
raven = `
<script src="https://cdn.ravenjs.com/2.3.0/raven.min.js"></script>
<script>
var path = (window.location.host === '${prod_host}') ? '${raven_prod}' : '${raven_stage}';
Raven.config(path,{release: '${VERSION}'}).install()
</script>`
}
webpackConfig.plugins.push(
new HtmlWebpackPlugin({
template: paths.client('index.esj'),
hash: false,
favicon: paths.client('static/favicon.ico'),
filename: 'index.html',
inject: 'body',
raven,
minify: {
collapseWhitespace: true,
},
})
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment