-
-
Notifications
You must be signed in to change notification settings - Fork 27
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
Not working with source mapping #4
Comments
Seeing similar error with ember-cli 0.1.15. |
We're having the same issue over here on ember-cli 0.2.0 and ember-cli-uglify 1.0.1. Tested multiple node/io.js versions. The issue only goes away if we disable minification entirely by setting EmberCLI's |
Is it just me or does it seem odd that the column is a negative number? (I'm running into this as well and trying to debug it.) |
Seems like this always happens in |
It at least seems to always go through this codepath before blowing up to give the generated sourcemap. https://github.com/mishoo/UglifyJS2/blob/master/lib/sourcemap.js#L59 |
@SimonKaluza @matthiasleitner @mcm-ham Are any of you all using es5-shim? I think the \f (form feed) in the file may be throwing things off. |
@fivetanley Yep, we're using es5-shim 4.1.0 from bower |
It looks like all of a sudden the |
Does the ember-cli build pipeline have some sort of "run this last" declaration to avoid that kind of order constraint? |
This is the problem: emberjs/data#2871 |
Ember Data was the problem here. I hotfixed (removed the sourcemapping url) from the production files on the bower components repo. Can everyone try:
and report back? I didn't realize the production files had source mapping urls. Sorry for breaking this everyone, we'll make sure we get it fixed for the next release of Ember Data. Thanks @ef4 for figuring it out! |
Nice find @ef4 and nice fix @fivetanley! Thanks. EDIT I was a bit hasty with this comment, I'm still getting that error. When I tested it late last night I hadn't actually remembered to turn my uglifyJS option back to true! :-/ |
@fivetanley I'm still seeing it in our project https://github.com/crossroads/app.goodcity, but works if I create a new project. Will try removing packages to see if there is some other package causing this. |
@mcm-ham I am sorry to hear you are still having issues. I double checked just to make sure (i removed it on several versions) and it looks like beta.15 (the version in your project) should have it removed: https://github.com/components/ember-data/blob/1.0.0-beta.15/ember-data.prod.js#L12728 I'll keep checking back, sorry for the pain. :( |
Thanks fivetanley. Actually I can reproduce this on a new project. Brocfile.js: var app = new EmberApp({
minifyCSS: {enabled:true},
minifyJS: {enabled:true}
}); ember build I had followed the steps in ember-cli/broccoli-terser-sourcemap#1 when I tested a new project before and it works, but was actually doing this when testing our project since we created a staging environment. |
@mcm-ham I was not able to reproduce with a new ember cli app. Maybe I missed a step... would you mind throwing up the repository on github so I can reference it? also the output of |
@fivetanley sure, here's the repo: embe-cli -v npm -v bower -v |
I opened an issue in ember-cli/ember-cli#3527, but I'm open to moving the discussion here. After pulling from the most recent ember-data bower package, I'm still experiencing this problem. Furthermore, I can also reproduce this issue using @mcm-ham's instructions above. ember -v npm -v bower -v |
I'm also seeing this error when trying to build for production, and I've already updated to the latest commit of ember-data. Removing packages just moves the error around, and now the error is supposedly coming from ember-cli itself:
|
FWIW, the ember-uglify-error-demo does reproduce the error for me as well.
|
@Dweebit It's working for me for production builds, it's just non-production builds it's not working for me. So by updating to the latest version of ember-data I take it you mean you ran Brocfile.js: var app = new EmberApp({
sourcemaps: ['js']
}); staging=true ember build --environment=production And then in code using this to check if I'm actually in staging not production: process.env.staging === 'true' |
I'm also able to reproduce this error using the demo repo, with a an npm and bower install right after cleaning the cache. Are there other libraries with invalid source map URLs? |
@mcm-ham actually, the |
I am having the same issue for non-production builds with the following settings in Brocfile.js.
My environment information are below.
As long as I disable Is this still an issue here? |
Is there any movement on this issue? Source-maps are fundamentally broken in the Ember ecosystem it seems. |
Lots of people use sourcemaps fine, with minification. But it breaks if one of your deps is shipping a bad sourcemaps. |
Is it possible to ignore and warn the bad sourcemap for faulty dep, rather than causing the entire build to fail? |
Using ember-cli 1.13.8 I run
Then I run
|
@ef4 I'm not trying to pile on here, but this seems to be getting totally dismissed. This is definitely not a bad 3rd party dep problem. This is happening with brand new ember-cli projects. Here's the only file change I made in a brand new project: /* global require, module */
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
module.exports = function(defaults) {
var app = new EmberApp(defaults, {
minifyJS: {
enabled: true // Test out minification with source mapping
}
});
// Use `app.import` to add additional libraries to the generated
// output files.
//
// If you need to use different assets in different
// environments, specify an object as the first parameter. That
// object's keys should be the environment name and the values
// should be the asset to use in that environment.
//
// If the library that you are including contains AMD or ES6
// modules that you would like to import into your application
// please specify an object with the list of modules as keys
// along with the exports of each module as its value.
return app.toTree();
}; And here is the full output from my console for the steps: 15:54:41 kjones /Users/kjones/code/js ()
$ ember new test-minify
Future versions of Ember CLI will not support v4.2.1. Please update to Node 0.12 or io.js.
version: 1.13.8
installing app
create .bowerrc
create .editorconfig
create .ember-cli
create .jshintrc
create .travis.yml
create .watchmanconfig
create README.md
create app/app.js
create app/components/.gitkeep
create app/controllers/.gitkeep
create app/helpers/.gitkeep
create app/index.html
create app/models/.gitkeep
create app/router.js
create app/routes/.gitkeep
create app/styles/app.css
create app/templates/application.hbs
create app/templates/components/.gitkeep
create bower.json
create config/environment.js
create ember-cli-build.js
create .gitignore
create package.json
create public/crossdomain.xml
create public/robots.txt
create testem.json
create tests/.jshintrc
create tests/helpers/resolver.js
create tests/helpers/start-app.js
create tests/index.html
create tests/test-helper.js
create tests/unit/.gitkeep
create vendor/.gitkeep
Installed packages for tooling via npm.
Installed browser packages via Bower.
Successfully initialized git.
15:56:38 kjones /Users/kjones/code/js ()
$ cd test-minify/
15:57:13 kjones /Users/kjones/code/js/test-minify (master)
$ vim ember-cli-build.js
15:58:38 kjones /Users/kjones/code/js/test-minify (master)
$ ember serve
Future versions of Ember CLI will not support v4.2.1. Please update to Node 0.12 or io.js.
version: 1.13.8
Livereload server on http://localhost:49152
Serving on http://localhost:4200/
File: assets/vendor.js
Invalid mapping: {"generated":{"line":86654,"column":-50},"source":"ember-cli-app-version/components/app-version.js","original":{"line":1,"column":0},"name":null}
Error: Invalid mapping: {"generated":{"line":86654,"column":-50},"source":"ember-cli-app-version/components/app-version.js","original":{"line":1,"column":0},"name":null}
at SourceMapGenerator_validateMapping [as _validateMapping] (/Users/kjones/code/js/test-minify/node_modules/ember-cli-uglify/node_modules/broccoli-uglify-sourcemap/node_modules/uglify-js/node_modules/source-map/lib/source-map-generator.js:271:15)
at SourceMapGenerator_addMapping [as addMapping] (/Users/kjones/code/js/test-minify/node_modules/ember-cli-uglify/node_modules/broccoli-uglify-sourcemap/node_modules/uglify-js/node_modules/source-map/lib/source-map-generator.js:101:14)
at /Users/kjones/code/js/test-minify/node_modules/ember-cli-uglify/node_modules/broccoli-uglify-sourcemap/node_modules/uglify-js/node_modules/source-map/lib/source-map-generator.js:72:19
at Array.forEach (native)
at SourceMapConsumer_eachMapping [as eachMapping] (/Users/kjones/code/js/test-minify/node_modules/ember-cli-uglify/node_modules/broccoli-uglify-sourcemap/node_modules/uglify-js/node_modules/source-map/lib/source-map-consumer.js:155:16)
at Function.SourceMapGenerator_fromSourceMap [as fromSourceMap] (/Users/kjones/code/js/test-minify/node_modules/ember-cli-uglify/node_modules/broccoli-uglify-sourcemap/node_modules/uglify-js/node_modules/source-map/lib/source-map-generator.js:48:26)
at Object.SourceMap (eval at <anonymous> (/Users/kjones/code/js/test-minify/node_modules/ember-cli-uglify/node_modules/broccoli-uglify-sourcemap/node_modules/uglify-js/tools/node.js:22:1), <anonymous>:7575:52)
at Object.exports.minify (/Users/kjones/code/js/test-minify/node_modules/ember-cli-uglify/node_modules/broccoli-uglify-sourcemap/node_modules/uglify-js/tools/node.js:102:38)
at UglifyWriter.processFile (/Users/kjones/code/js/test-minify/node_modules/ember-cli-uglify/node_modules/broccoli-uglify-sourcemap/index.js:99:27)
at /Users/kjones/code/js/test-minify/node_modules/ember-cli-uglify/node_modules/broccoli-uglify-sourcemap/index.js:46:14
Content Security Policy violation: {"csp-report":{"document-uri":"http://localhost:4200/","referrer":"http://localhost:4200/","violated-directive":"style-src 'self'","effective-directive":"style-src","original-policy":"default-src 'none'; script-src 'self' 'unsafe-eval' localhost:49152 0.0.0.0:49152; font-src 'self'; connect-src 'self' ws://localhost:49152 ws://0.0.0.0:49152 http://0.0.0.0:4200/csp-report; img-src 'self'; style-src 'self'; media-src 'self'; report-uri http://0.0.0.0:4200/csp-report;","blocked-uri":"","status-code":500}}
^C16:06:09 kjones /Users/kjones/code/js/test-minify (master)
$ ember --version
Future versions of Ember CLI will not support v4.2.1. Please update to Node 0.12 or io.js.
version: 1.13.8
node: 4.2.1
npm: 2.13.4
os: darwin x64 I can put this into a repo and share it, but that seems like overkill for an almost untouched base project. |
For anyone looking for a hacky workaround, I've whipped something up that helps. I grep -lr --include=*.js sourceMappingURL bower_components/ | xargs gsed -i 's/sourceMappingURL//g' I've added that to my |
@matthiasleitner thx for workaround ) |
👍 for hack! :) |
Sorry to those who keep running into this. I don't think this should be happening anymore on recent versions of Ember Data. I was responsible for generating the invalid sourcemaps. I think we ended up just removing the sourcemap comment in the bower releases. As of 2.3.0 Ember Data will be a full fledged Ember CLI addon, but if I missed your release of Ember Data let me know and I'll see what we can do. This should definitely not be happening for new apps so ping me if it is. |
I was having issues with a number of addons that we're bringing in bower libraries that had their own sourmap comments, not just ember-data On December 18, 2015 at 2:52:36 PM, Stanley Stuart (notifications@github.com) wrote: As of 2.3.0 Ember Data will be a full fledged Ember CLI addon, but if I missed your release of Ember Data let me know and I'll see what we can do. This should definitely not be happening for new apps so ping me if it is. — |
can you provide a list? |
Tracked this down to |
I'm still having this issue
|
@Cryrivers this might be from another package. I would check all your bower components... |
{
"dependencies": {
"ember": "2.3.0",
"ember-cli-shims": "0.1.0",
"ember-cli-test-loader": "0.2.2",
"ember-load-initializers": "0.1.7",
"ember-qunit-notifications": "0.1.0",
"jquery": "~2.2.0",
"normalize.css": "~3.0.3",
"Sortable": "1.4.2",
"phoneformat": "phoneformat.js#~1.0.2",
"rangyinputs": "~1.2.0",
"Caret.js": "caret.js#~0.2.2",
"animation-frame": "~0.2.4",
"cropper": "~1.0.0",
"js-cookie": "^2.0",
"loader.js": "^3.5.0",
"socket.io-client": "~1.3.7",
"json-bigint": "~0.0.0",
"qunit": "~1.20.0",
"sanitize.js": "~1.0.0"
},
"resolutions": {
"jquery": "~2.2.0"
}
} |
EDIT: Some info in this comment was later determined to be incorrect, see discussion here: ember-cli/broccoli-terser-sourcemap#23 Here's an updated repo which reproduces the issue: https://github.com/johnnyshields/ember-sourcemap-issue
|
Lets transplant this conversation over to: ember-cli/broccoli-terser-sourcemap#23 |
@stefanpenner @ef4 Update: I've made a test here: broccolijs/broccoli-concat#50 for what I believe to be the root cause--broccoli-concat is generating an invalid vendor.js/vendor.map which broccoli-uglify-sourcemap chokes on later in the build process. |
Some bugs in the build toolchain causes issues when generating sourcemaps for some bower libraries. Disabling the JS minification works around the issue. See ember-cli/ember-cli-terser#4
We need to enable the source map generation, but doing so we had this issue (ember-cli#4). To solve it, we need to update the ember-intl to at least version 2.1.0. The problem is that when updating it we start getting a new error: ``` node_modules/ember-cli-uglify/index.js:6 included(app) { ^ Unexpected token ( ``` This is because we are using an old version of node that not deal with new javascript syntax very well. So, to fix the issue without the need to the node version right now, we created this version with this commit on top of the version 2.1.0.
We need to enable the source map generation, but doing so we had this issue (ember-cli#4). To solve it, we need to update the ember-intl to at least version 2.1.0. The problem is that when updating it we start getting a new error: ``` node_modules/ember-cli-uglify/index.js:6 included(app) { ^ Unexpected token ( ``` This is because we are using an old version of node that not deal with new javascript syntax very well. So, to fix the issue without the need to the node version right now, we created this version with this commit on top of the version 2.1.0.
I solved this (or a similar issue) by adding this to my // …
'ember-cli-terser': {
terser: {
compress: {
sequences: false,
},
output: {
beautify: true,
semicolons: true,
comments: false,
indent_level: 2,
},
sourceMap: false, // ADDED
},
hiddenSourceMap: true, // ADDED
}, Perhaps it helps someone else. |
Since that info is mostly in the README ( |
With ember-cli 0.2.0, node 0.12 and ember-cli-uglify 1.0.1 I'm getting this error:
If I remove select2 I get the same error with the next vendor package I have included so don't think it's specific to select2.
The text was updated successfully, but these errors were encountered: