-
-
Notifications
You must be signed in to change notification settings - Fork 272
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
[0.17.0-beta.44] source map has problem ! can't debug ! (0.17.0-beta.42 is okay !! ) #2361
Comments
I will try to take a look at this tonight |
@shaoahs is there anyway you can share a replication here? |
create a project. project tree like this
procedure
Gruntfile.js
package.json
web/index.html
web/jspm.config.js
web/src/app.js
======================================================
use this command . has problem.
|
I am having the same issue. My project was working fine till I am bundling like this What I see happening is baseUrl for my project files are wrong, they include the entire filesystem path. Attaching a screenshot fro developer tools file explorer. |
The source maps PR that was merged most recently was in systemjs/builder#823. It seems like this may have caused the break. We can possibly look at reverting for the next release. |
@jithin1987 How are you transpiling the code - is it a separate build step, and then you bundle the resulting .js files, or are you using one of the transpiler options in JSPM? My guess is you have an absolute path in there, rooted in a drive letter. Previously such paths were resolved to relative paths when the source maps were generated for the bundle, which could produce some unexpected results with some folder structures - with the recent changes, they are now preserved as absolute, rooted paths. If it's causing issues with the transpilation build into JSPM, then we probably need to change that so such paths are still made relative, but otherwise I'd suggest you switch to using a relative path for Makes sense? |
@shaoahs Same question for you, what is the |
@thomas-darling I am using transpiler options in JSPM using I am not setting |
I don't know
|
@thomas-darling @guybedford Any updates on this ? This is blocking me from upgrading beyond 0.42 beta. Is this a case of me missing some settings ?
|
I've reproduced the issue using the example provided by @shaoahs, and as suspected, it was caused by that last Additionally, the use of The pull request fixes both of those issues - sorry for the inconvenience. |
I'm in the process of upgrading from JSPM beta 32 to latest version, beta 47. After the upgrade my source maps stopped working. I'm having the same problem as @jithin1987 had. The files show up empty in Chrome devtools because the source map uses an absolute path which devtools tries to load as How do I get it to use the relative path again. @thomas-darling maybe any pointers? |
@HeinrichFilter If you are on the latest version, then I'll be happy to take a look at it, if you can either provide an example that reproduces the issue, or at least some more info about your environment and how you are transpiling, generating source maps, bundling, etc. :-) Otherwise, the place to debug this is probably around the two lines affected by my pull requests: I suspect this might be a configuration problem though, as I'm pretty sure this works correctly now - it's possible that your configuration might technically have been wrong before, in order to work around the bugs that are now fixed. I'll need some more info to help you though :-) |
Thanks @thomas-darling, I appreciate your offer to help! The one config option that you mention earlier in this thread that I don't see in my project is
I suspect it is very likely that this is the case Commands that I ran to upgrade:
At this stage when I open build.js.map in a text editor it is full of references to the absolute paths of my files e.g.
Is this enough info or do you need something else? |
Hmm, that looks about right, although I have to say, I'm also fairly new to JSPM 0.17 configuration. Could you maybe try putting some log statements in there, so we can see what is happening? Insert on line https://github.com/systemjs/builder/blob/master/lib/sourcemaps.js#L52
Insert on line https://github.com/systemjs/builder/blob/master/lib/sourcemaps.js#L114
You can just hack those into your I just need a single sample for one of the paths that end up being absolute - not the complete dump :-) |
I've added the suggested logs. L52 logging is never reached. Upon further investigation it is because L114: Following is the console output for an external lib (which show up in Chrome devtools BTW) and for one of our project files:
I'll also dig a bit deeper but I hope you recognise something since you've worked with the code before. |
This is interesting - am I correct in assuming you’re not on a Windows machine? Now, the question is why I would like to think that the correct fix here would be to make @HeinrichFilter @guybedford |
Yes, I'm developing on Mac and building/CI/deploying on Ubuntu. And yes, I was stepping through the code and it is returning an absolute path after the I still don't quite understand in which case the paths shouldn't be converted to relative paths? Could you explain the reasoning why you added the To be clear, for my case, I would want the files to be converted to relative paths here. |
Thought so - I’ll prepare a pull request to fix this tomorrow :-) The previous pull requests were to fix a couple of different issues, one of which was an issue, where if you bundled files that had already been transpiled, and thus already had accompanying source map files, then any root-relative source paths in those source maps would become messed up. Basically, if you already have a source map file with root-relative source paths, then it should just use those as-is. Your scenario is a bit different, as you are using the built in transpiler, and that use case seemed to work correctly before my pull requests. Hopefully this will be the last issue with this though - I tested it pretty thoroughly last time - just didn’t realize the behavior was different on UNIX. |
Strangely enough, I'm on Windows machine and still having the same issue. SystemJS v0.20.19 Dev My paths in source maps file looks like so:
Here is my SystemJS.config({
baseURL: "/source/scripts",
browserConfig: {
"paths": {
"npm:": "/jspm_packages/npm/",
"github:": "/jspm_packages/github/",
"main/": "",
"@data": "/temp/data/scripts.json"
}
},
nodeConfig: {
"paths": {
"npm:": "jspm_packages/npm/",
"github:": "jspm_packages/github/",
"main/": "source/scripts/",
"@data": "temp/data/scripts.json"
}
},
devConfig: {...},
meta: {
"@data": {
"loader": "json"
},
"*.vue": {
"loader": "systemjs-plugin-vue"
}
},
transpiler: "plugin-babel",
packages: {
"main": {
"main": "main.js",
"format": "esm",
"meta": {
"*.js": {
"loader": "plugin-babel"
},
"*.json": {
"loader": "json"
}
}
}
},
map: {
"@hot": "@empty",
"json": "npm:[email protected]"
}
});
SystemJS.config({
packageConfigPaths: [
"npm:@*/*.json",
"npm:*.json"
],
map: {
"babel-polyfill": "npm:[email protected]",
"fs": "npm:[email protected]",
"moment": "npm:[email protected]",
"numbro": "npm:[email protected]",
"path": "npm:[email protected]",
"process": "npm:[email protected]",
"smart-plurals": "npm:[email protected]",
"tcomb": "npm:[email protected]",
"vue": "npm:[email protected]",
"vue-router": "npm:[email protected]",
"vue-slider-component": "npm:[email protected]",
"vuex": "npm:[email protected]"
},
packages: {
"npm:[email protected]": {
"map": {
"regenerator-runtime": "npm:[email protected]",
"core-js": "npm:[email protected]",
"babel-runtime": "npm:[email protected]"
}
},
"npm:[email protected]": {
"map": {
"regenerator-runtime": "npm:[email protected]",
"core-js": "npm:[email protected]"
}
},
"npm:[email protected]": {
"map": {
"bignumber.js": "npm:[email protected]"
}
}
}
}); |
@ArmorDarks weirdly enough I've been seeing this on Windows as well but only when using TypeScript as my transpiler. If I use Babel everything works as expected. |
I've created an empty project and inited it with JSPM 0.17.0-beta.47 I've received same broken paths:
The problem seems to vanish when I remove
So, it seems to be somehow connected to My guess that it's caused not exactly by Here is test case I've used at Dropbox. |
I just got back from a month in Thailand, so I’m a bit busy catching up to other things, and won’t have time to look into this right now. I noticed one thing though - the incorrect source paths posted here all seem to contain a part starting with “file:/“, but the function testing whether it is a file URL test for “file:///“ - note the different number of “/“. I’m guessing, that because of that, the path is probably not be recognized as a file URL, which would explain why it ends up being concatenated with the base URL. Now, I don’t believe I messed with that function in any of my earlier pull requests, so that would make this a separate bug. I don’t know why the function is testing for exactly “file:///“ - I’d day a test for just “file:” should be enough, and that would likely fix the bug. As I said, I won’t have time to look deeper into this right now, so someone else will have to take it from here :-) |
@guybedford maybe this issue should be reopened? |
The issue seems to be coming not from the file protocol check in SystemJS builder I've tried to log paths there, and SystemJS builder Here what I've got:
I've been able to trace issue to the
But after
In
Well, that's where I was able to dig. It seems to be somehow related to Rollup, or the wrong configuration of Rollup on Windows systems. I've tried to play with Rollup settings in SystemJS builder, and noticed that receives following method:
where
Seems like it is the reason why Rollup in
I've tried to replace in
That changed generated source file from non-working
to be
Which results in working source maps. Unfortunately, I'm not sure if that fix a correct approach at all. Filepaths with For now, I can't get are tracers returning paths with the protocol on purpose, or it's a bug. |
Since it seems to be related to builder and not JSPM itself, I've created systemjs/builder#845 |
JSPM Version:
0.17.0-beta.44
Transpiler Plugin(s): babel
Details:
source map has problem ! can't debug ! (0.17.0-beta.42 is okay !! )
command
jspm bundle <%= pkg.source %> web/debug/build.js -d --config jspm.build.json --inject
The text was updated successfully, but these errors were encountered: