Skip to content

Commit

Permalink
Fix sourcemaps
Browse files Browse the repository at this point in the history
  • Loading branch information
Anand Thakker committed Feb 23, 2018
1 parent 1f804df commit 6b43ad0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
"rollup-plugin-commonjs": "^8.2.6",
"rollup-plugin-flow": "^1.1.1",
"rollup-plugin-node-resolve": "3.0.0",
"rollup-plugin-sourcemaps": "^0.4.2",
"rollup-plugin-uglify": "^3.0.0",
"sinon": "^2.1.0",
"slugg": "^1.2.1",
Expand Down
17 changes: 8 additions & 9 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@ import json from 'rollup-plugin-json';
import browserifyPlugin from 'rollup-plugin-browserify-transform';
import brfs from 'brfs';
import uglify from 'rollup-plugin-uglify'
import sourcemaps from 'rollup-plugin-sourcemaps';
import minifyStyleSpec from './build/rollup_plugin_minify_style_spec';

const production = process.env.BUILD === 'production';
const outputFile = production ? 'dist/mapbox-gl.js' : 'dist/mapbox-gl-dev.js';

const plugins = [
flow(),
sourcemaps(),
flow({pretty: true}), // setting {pretty: true} works around https://github.com/leebyron/rollup-plugin-flow/issues/5
minifyStyleSpec(),
json(),
buble({transforms: {dangerousForOf: true}, objectAssign: "Object.assign"}),
unassert(),
production ? unassert() : false,
resolve({
browser: true,
preferBuiltins: false
Expand All @@ -29,12 +31,9 @@ const plugins = [
namedExports: {
'@mapbox/gl-matrix': ['vec3', 'vec4', 'mat2', 'mat3', 'mat4']
}
})
]

if (production) {
plugins.push(uglify());
}
}),
production ? uglify() : false
].filter(Boolean)

const config = [{
input: ['src/index.js', 'src/source/worker.js'],
Expand All @@ -54,7 +53,7 @@ const config = [{
format: 'umd',
sourcemap: production ? true : 'inline'
},
plugins: production ? [] : [uglify()],
plugins: production ? [sourcemaps(), uglify()] : [sourcemaps()],
intro: `
let shared, worker, mapboxgl;
function define(_, module) {
Expand Down
7 changes: 7 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8632,6 +8632,13 @@ rollup-plugin-node-resolve@3.0.0:
is-module "^1.0.0"
resolve "^1.1.6"

rollup-plugin-sourcemaps@^0.4.2:
version "0.4.2"
resolved "https://registry.yarnpkg.com/rollup-plugin-sourcemaps/-/rollup-plugin-sourcemaps-0.4.2.tgz#62125aa94087aadf7b83ef4dfaf629b473135e87"
dependencies:
rollup-pluginutils "^2.0.1"
source-map-resolve "^0.5.0"

rollup-plugin-uglify@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/rollup-plugin-uglify/-/rollup-plugin-uglify-3.0.0.tgz#a34eca24617709c6bf1778e9653baafa06099b86"
Expand Down

0 comments on commit 6b43ad0

Please sign in to comment.