Skip to content

Commit

Permalink
add commit SHA for build to debug vars
Browse files Browse the repository at this point in the history
  • Loading branch information
bcamper committed Jan 17, 2019
1 parent e19aee4 commit 38da497
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions build/bundle.js
Expand Up @@ -10,8 +10,9 @@ import './index'; // main thread code, gets exported as main library b
// This allows the rollup ESM build to work within a <script type="module"> tag
// Script modules can't expose exports
try {
Tangram.debug.ESM = ESMODULE; // mark build as ES module
if (ESMODULE === true && typeof window === 'object') {
Tangram.debug.ESM = _ESM; // mark build as ES module
Tangram.debug.SHA = _SHA;
if (_ESM === true && typeof window === 'object') {
window.Tangram = Tangram;
}
} catch(e) {}
Expand Down
4 changes: 3 additions & 1 deletion rollup.config.js
@@ -1,4 +1,5 @@
import fs from 'fs';
import { execSync } from 'child_process';

import babel from 'rollup-plugin-babel';
import resolve from 'rollup-plugin-node-resolve';
Expand Down Expand Up @@ -75,7 +76,8 @@ const config = [{
treeshake: false,
plugins: [
replace({
ESMODULE: ESM
_ESM: ESM,
_SHA: '\'' + String(execSync('git rev-parse HEAD')).trim(1) + '\''
}),
sourcemaps(), // use source maps produced in the first pass

Expand Down

0 comments on commit 38da497

Please sign in to comment.