This repository was archived by the owner on May 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 307
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(webpack): source maps link to original src for ide debugging
source maps link to original src for ide debugging
- Loading branch information
1 parent
81f1d75
commit 39edd2e
Showing
5 changed files
with
32 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
import { IonicEnvironmentPlugin } from './ionic-environment-plugin'; | ||
import { provideCorrectSourcePath } from './source-mapper'; | ||
import { getContext } from '../util/helpers'; | ||
|
||
|
||
export function getIonicEnvironmentPlugin() { | ||
const context = getContext(); | ||
return new IonicEnvironmentPlugin(context.fileCache); | ||
} | ||
|
||
export function getSourceMapperFunction(): Function { | ||
return provideCorrectSourcePath; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { BuildContext } from '../util/interfaces'; | ||
import { getContext} from '../util/helpers'; | ||
import { normalize, resolve, sep } from 'path'; | ||
|
||
export function provideCorrectSourcePath(webpackObj: any) { | ||
const context = getContext(); | ||
return provideCorrectSourcePathInternal(webpackObj, context); | ||
} | ||
|
||
function provideCorrectSourcePathInternal(webpackObj: any, context: BuildContext) { | ||
const webpackResourcePath = webpackObj.resourcePath; | ||
const noTilde = webpackResourcePath.replace(/~/g, 'node_modules'); | ||
const absolutePath = resolve(normalize(noTilde)); | ||
if (process.env.IONIC_SOURCE_MAP === 'eval') { | ||
// add another path.sep to the front to account for weird webpack behavior | ||
return sep + absolutePath; | ||
} | ||
return absolutePath; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters