Skip to content

Conversation

@clydin
Copy link
Member

@clydin clydin commented Feb 17, 2021

This change uses Webpack's sourcemap processing to merge sourcemaps generated from the customized babel loader used to perform the partial compilation linking in applications.
Webpack's sourcemap processing supports identity mappings which allow character to character mappings to the original source.

@google-cla google-cla bot added the cla: yes label Feb 17, 2021
…maps

This change uses Webpack's sourcemap processing to merge sourcemaps generated from the customized babel loader used to perform the partial compilation linking in applications.
Webpack's sourcemap processing supports identity mappings which allow character to character mappings to the original source.
@clydin clydin force-pushed the babel-loader-sourcemaps branch from 2999765 to 21c0188 Compare February 17, 2021 16:28
Comment on lines +151 to +164
result(result, { source, map: inputSourceMap }) {
if (result.map && inputSourceMap) {
result.map = new SourceMapSource(
result.code || '',
this.resourcePath,
result.map,
source,
inputSourceMap as string,
true,
).map();
}

return result;
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This didn't help in my scenario. But this did:

        result(result, { map: inputSourceMap }) {
            if (result.map && inputSourceMap) {
              const fs = require('fs');
              const path = require('path');
              const sourcemaps = require('@angular/compiler-cli/src/ngtsc/sourcemaps');

              const fileSystem = {
                resolve: path.resolve,
                exists: fs.existsSync,
                dirname: path.dirname,
                relative: path.relative,
                readFile: fs.readFileSync,
              };
              const loader = new sourcemaps.SourceFileLoader(fileSystem, {}, {});
              const outputSource = loader.loadSourceFile(this.resourcePath, result.code, {map: result.map, path: this.resourcePath + '.map'});
              result.map = outputSource.renderFlattenedSourceMap()
            }
            return result;
        },

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But this is quite resource intensive and ends up running for a large number of files, not just the ones that have been linked.

@dgp1130
Copy link
Collaborator

dgp1130 commented Jun 10, 2021

Closing some old obsolete PRs.

@dgp1130 dgp1130 closed this Jun 10, 2021
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jul 11, 2021
@clydin clydin deleted the babel-loader-sourcemaps branch October 1, 2021 18:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants