Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove sourcemap directives #39

Open
sassanh opened this issue Aug 10, 2016 · 9 comments
Open

Remove sourcemap directives #39

sassanh opened this issue Aug 10, 2016 · 9 comments
Labels

Comments

@sassanh
Copy link

sassanh commented Aug 10, 2016

Thanks for creating and maintaining this package.
Could you please remove sourcemap directives (//# sourceMappingURL=index.js.map) from compiled js files in dist directory. I'm using lots of packages in my project but only redux-immutable has these directives and it makes some minor but annoying problems with browserify.

@gajus
Copy link
Owner

gajus commented Aug 10, 2016

No, sourceMappingURL are there for a reason – to enable source maps.

What are the issue that this is causing?

Regardless, this sounds more like a Browserify issue.

@sassanh
Copy link
Author

sassanh commented Aug 10, 2016

The only issue with browserify is that it doesn't allow me to eliminate these sourcemaps . Look at this browserify/browserify#772.

Many libraries provide source maps, but they use embedded sourcemaps. The way redux-immutable is referring to a url as the source map forces me to serve the map files and I don't want to serve those map files. The thing is browserify compiles all libraries to few js files. Then I can use these libraries without serving them as they're embedded in my bundle. If they provide base 64 sourcemaps, it's totally cool but if they provide sourcemaps in external files and hardcode the map file url in the code it'll lead to ugly warnings in browser about not being able to find the sourcemap. It's ridiculous to serve map files when I'm not even serving the main library.

Btw this is the list of dependencies in my project:

"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-plugin-transform-react-jsx": "^6.8.0",
"babel-preset-es2015": "^6.6.0",
"babel-preset-react": "^6.11.1",
"babel-preset-stage-0": "^6.5.0",
"babelify": "^7.3.0",
"browserify": "^13.0.1",
"browserify-css": "^0.9.1",
"color": "^0.11.3",
"factor-bundle": "^2.5.0",
"font-awesome": "^4.5.0",
"immutable": "^3.8.1",
"isomorphic-fetch": "^2.2.1",
"js-cookie": "^2.1.2",
"livereactload": "^2.3.0-rc7",
"loadjs": "^2.1.1",
"lodash": "^4.13.1",
"loose-envify": "^1.2.0",
"module-deps": "^4.0.7",
"query-string": "^4.2.2",
"radium": "^0.18.1",
"react": "^15.2.1",
"react-addons-css-transition-group": "^15.2.1",
"react-addons-pure-render-mixin": "^15.2.1",
"react-dom": "^15.2.1",
"react-redux": "^4.4.5",
"react-reorder": "^2.0.0",
"react-router": "^2.6.0",
"react-router-redux": "^4.0.5",
"react-slick": "^0.12.2",
"react-tap-event-plugin": "^1.0.0",
"react-tinymce": "^0.5.1",
"redux": "^3.5.2",
"redux-immutable": "^3.0.6",
"redux-multi": "^0.1.91",
"redux-thunk": "^2.1.0",
"svg4everybody": "^2.1.0",
"tinymce": "^4.4.0",
"yuglify": "^0.1.4"

"babel-plugin-react-transform": "^2.0.2",
"chai": "^3.5.0",
"chai-immutable": "^1.6.0",
"jsdom": "^9.4.1",
"livereactload": "^2.3.0-rc6",
"mocha": "^2.5.3",
"react-addons-test-utils": "^15.2.0",
"react-proxy": "^1.1.8",
"redux-devtools": "^3.3.1",
"redux-devtools-dock-monitor": "^1.1.1",
"redux-devtools-log-monitor": "^1.0.11",
"redux-slider-monitor": "^1.0.7",
"teaspoon": "^6.4.1",
"watchify": "^3.7.0"

and except redux-immutable none has external source maps (either they have no sourcemap, or it's base64 encoded embedded in the library.)

@gajus
Copy link
Owner

gajus commented Aug 10, 2016

and except redux-immutable none has external source maps (either they have no sourcemap, or it's base64 encoded embedded in the library.)

Not true.

$ npm install babel-plugin-transform-decorators-legacy
$ npm install babel-plugin-transform-react-jsx
$ npm install babel-preset-es2015
$ npm install babel-preset-react
$ npm install babel-preset-stage-0
$ npm install babelify
$ npm install browserify
$ npm install browserify-css
$ npm install color
$ npm install factor-bundle
$ npm install font-awesome
$ npm install immutable
$ npm install isomorphic-fetch
$ npm install js-cookie
$ npm install livereactload
$ npm install loadjs
$ npm install lodash
$ npm install loose-envify
$ npm install module-deps
$ npm install query-string
$ npm install radium
$ npm install react
$ npm install react-addons-css-transition-group
$ npm install react-addons-pure-render-mixin
$ npm install react-dom
$ npm install react-redux
$ npm install react-reorder
$ npm install react-router
$ npm install react-router-redux
$ npm install react-slick
$ npm install react-tap-event-plugin
$ npm install react-tinymce
$ npm install redux
$ npm install redux-immutable
$ npm install redux-multi
$ npm install redux-thunk
$ npm install svg4everybody
$ npm install tinymce
$ npm install yuglify
$ npm install babel-plugin-react-transform
$ npm install chai
$ npm install chai-immutable
$ npm install jsdom
$ npm install livereactload
$ npm install mocha
$ npm install react-addons-test-utils
$ npm install react-proxy
$ npm install redux-devtools
$ npm install redux-devtools-dock-monitor
$ npm install redux-devtools-log-monitor
$ npm install redux-slider-monitor
$ npm install teaspoon
$ npm install watchify
$ ag -l -Q sourceMappingURL ./node_modules
node_modules/async/dist/async.min.js
node_modules/browser-pack/example/sourcemap/output.js
node_modules/browser-pack/test/source-maps.js
node_modules/browserify/example/source_maps/js/build/bundle.js
node_modules/browserify/test/bundle_sourcemap.js
node_modules/browserify/test/debug_standalone.js
node_modules/browserify-css/examples/node_modules/bootstrap/dist/css/bootstrap-theme.css.map
node_modules/browserify-css/examples/node_modules/bootstrap/dist/css/bootstrap-theme.css
node_modules/browserify-css/examples/node_modules/bootstrap/dist/css/bootstrap.css.map
node_modules/browserify-css/examples/node_modules/bootstrap/dist/css/bootstrap.css
node_modules/browserify-css/examples/submodules/bundle.js
node_modules/combine-source-map/example/two-files-short.js
node_modules/combine-source-map/node_modules/convert-source-map/example/comment-to-json.js
node_modules/combine-source-map/node_modules/convert-source-map/README.md
node_modules/combine-source-map/node_modules/convert-source-map/test/comment-regex.js
node_modules/combine-source-map/node_modules/convert-source-map/test/fixtures/map-file-comment-double-slash.css
node_modules/combine-source-map/node_modules/convert-source-map/index.js
node_modules/combine-source-map/node_modules/convert-source-map/test/convert-source-map.js
node_modules/combine-source-map/node_modules/convert-source-map/test/fixtures/map-file-comment-inline.css
node_modules/combine-source-map/node_modules/convert-source-map/test/fixtures/map-file-comment.css
node_modules/combine-source-map/node_modules/convert-source-map/test/map-file-comment.js
node_modules/combine-source-map/README.md
node_modules/convert-source-map/example/comment-to-json.js
node_modules/convert-source-map/index.js
node_modules/convert-source-map/README.md
node_modules/convert-source-map/test/comment-regex.js
node_modules/convert-source-map/test/convert-source-map.js
node_modules/convert-source-map/test/fixtures/map-file-comment.css
node_modules/convert-source-map/test/fixtures/map-file-comment-double-slash.css
node_modules/convert-source-map/test/fixtures/map-file-comment-inline.css
node_modules/convert-source-map/test/map-file-comment.js
node_modules/core-js/client/core.min.js
node_modules/core-js/client/library.min.js
node_modules/core-js/client/shim.min.js
node_modules/factor-bundle/node_modules/browser-pack/example/sourcemap/output.js
node_modules/factor-bundle/node_modules/browser-pack/test/source-maps.js
node_modules/factor-bundle/node_modules/combine-source-map/example/two-files-short.js
node_modules/factor-bundle/node_modules/combine-source-map/README.md
node_modules/factor-bundle/node_modules/convert-source-map/example/comment-to-json.js
node_modules/factor-bundle/node_modules/convert-source-map/index.js
node_modules/factor-bundle/node_modules/convert-source-map/test/comment-regex.js
node_modules/factor-bundle/node_modules/convert-source-map/test/fixtures/map-file-comment-inline.css
node_modules/factor-bundle/node_modules/convert-source-map/test/fixtures/map-file-comment.css
node_modules/factor-bundle/node_modules/convert-source-map/test/convert-source-map.js
node_modules/factor-bundle/node_modules/convert-source-map/README.md
node_modules/factor-bundle/node_modules/convert-source-map/test/fixtures/map-file-comment-double-slash.css
node_modules/factor-bundle/node_modules/convert-source-map/test/map-file-comment.js
node_modules/factor-bundle/node_modules/inline-source-map/README.md
node_modules/factor-bundle/node_modules/inline-source-map/index.js
node_modules/factor-bundle/node_modules/inline-source-map/test/source-content.js
node_modules/factor-bundle/node_modules/inline-source-map/test/inline-source-map.js
node_modules/fbjs/node_modules/core-js/client/core.min.js
node_modules/fbjs/node_modules/core-js/client/library.min.js
node_modules/fbjs/node_modules/core-js/client/shim.min.js
node_modules/fsevents/node_modules/async/dist/async.min.js
node_modules/inline-source-map/index.js
node_modules/inline-source-map/test/source-content.js
node_modules/inline-source-map/README.md
node_modules/inline-source-map/test/inline-source-map.js
node_modules/insert-module-globals/test/sourcemap/main.js
node_modules/jquery/external/sizzle/dist/sizzle.min.js
node_modules/react-tap-event-plugin/node_modules/core-js/client/core.min.js
node_modules/react-tap-event-plugin/node_modules/core-js/client/library.min.js
node_modules/react-tap-event-plugin/node_modules/core-js/client/shim.min.js
node_modules/source-map/dist/source-map.min.js
node_modules/source-map/dist/source-map.debug.js
node_modules/source-map-support/amd-test/script.js
node_modules/source-map-support/amd-test/browser-source-map-support.js
node_modules/source-map-support/browser-source-map-support.js
node_modules/source-map-support/build.js
node_modules/source-map-support/browser-test/script.js
node_modules/source-map-support/README.md
node_modules/source-map-support/source-map-support.js
node_modules/source-map-support/test.js

This sounds like an issue of Browserify as opposed to anything else.

Using sourceMappingURL is the recommended way to add source maps to the distribution files. https://developers.google.com/web/updates/2013/06/sourceMappingURL-and-sourceURL-syntax-changed?hl=en

I will leave this open to see if anyone else stumbles across this issue. I cannot find many issue threads talking about this issue.

@sassanh
Copy link
Author

sassanh commented Aug 10, 2016

Thanks for keeping this open.
You got it wrong, what I said is true, browser-pack, factor-bundle, browserify, combine-source-map, convert-source-map, inline-source-map, core-js and source-map-support all are modules that provide tools for providing source maps. If you eliminate these packages and change your ag command to ag -l 'sourceMappingURL.{0,100}map' (to eliminate the base64 source maps) you see as I said none of the packages I mentioned are putting url source maps in their library files (they may put base64 source maps as I said here:

(either they have no sourcemap, or it's base64 encoded embedded in the library.)

but no url source map.)

I wanna know what's your alternative? Do you expect the end user to serve the source map files along with your library? It's not good idea. So I guess if you don't want to remove these source maps it'd be fine if you change it to base64 source maps instead of urls to external files.

@sassanh
Copy link
Author

sassanh commented Aug 10, 2016

I'm sure if any of these packages had url source maps in their library files, I'd see warnings for them too as I'm not serving any files except the bundles I create with browserify (3 js files, no .map files.) I just wanna assure you that none of above packages are putting url source maps in the library files.

@gajus
Copy link
Owner

gajus commented Jan 11, 2017

//# sourceMappingURL=index.js.map has been removed from ./dist.

@gajus gajus closed this as completed Jan 11, 2017
@sassanh
Copy link
Author

sassanh commented Feb 3, 2017

@gajus it's still there in 3.0.11 (released 3 days ago), should I wait for next version?

@sassanh
Copy link
Author

sassanh commented Feb 23, 2017

@gajus it's still there in 3.1.0 (released a week ago).

@sassanh
Copy link
Author

sassanh commented Feb 23, 2017

Take a look at this just as an example: https://github.com/reactjs/redux/blob/master/package.json it's not generating sourcemaps. Maybe we need a build-dev that generates sourcemaps only for repo's developers.

@gajus gajus reopened this Feb 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants