-
Notifications
You must be signed in to change notification settings - Fork 220
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
Sourcemaps with normal Usage, not Alternative usage #109
Comments
@BrainCrumbz As recommended in the README, in my karma.conf.js I have: files: ['client/tests.entry.ts'],
preprocessors: {
'client/tests.entry.ts': [
'webpack',
'sourcemap'
]
},
webpack: {
entry: './client/tests.entry.ts',
verbose: true,
devtool: 'inline-source-map',
// ...rest of my webpack config
} but the error messages do not map back to the source files:
Anyone know what I'm doing wrong? |
+1 |
I can verify this with a simple test:
Outputs
This works nice. But let us change
Outputs
The mapping is lost. |
I was faced with the same problem. webpack.config.js
karma.conf.js
|
@donaldpipowitch #109 (comment) |
typescript or webpack doesn't emit source maps if file extenstion is not js // replace this
webpackOptions.output.filename = "[name]";
// by that
webpackOptions.output.filename = "[name].js";
// find this line
Plugin.prototype.readFile = function(file, callback) {
// insert this condition
if (file.substr(-3) !== '.js') {
file += '.js';
} |
@cevek How about a PR? |
Here it is #127 |
Here's native solution to make source map work in typescript unit tests: plugins: [
new webpack.SourceMapDevToolPlugin({
filename: null, // if no value is provided the sourcemap is inlined
test: /\.(ts|js)($|\?)/i // process .js and .ts files only
})
] |
Resolving this one. Multiple resolutions in the issue & the extension bug is a known issue |
I see the sourcemaps in the browser. However, when I try to add a breakpoint it sends me to the bundled code. Is that normal? Also the line is off by 2 in the console and only points to the |
I'm also seeing bundles code same as @adam-beck mentioned. When I click Debug in Karma, and open for example app.component.spec.ts in my Angular 4 project, I see the WebPack bundled source, not the original .ts file. |
We're having troubles trying to make source maps work with typescript spec source files and main source files.
If we stick with the Alternative usage described here, then generate source maps as suggested in following section here, we can happily browse typescript code from Chrome developer tools while debugging tests.
If we stick with the basic usage described here, and we load spec files through
karma.conf.js
, instead ofrequire
-ing them in test shim single entry point, it looks like sourcemaps stop working. Browser developer tools only show JS webpack-prepared bundles, not original typescript source files.Is this second way feasible at all? Can anybody explain how to get there? Thanks for your time!
The text was updated successfully, but these errors were encountered: