Skip to content

Broken source maps due to __CHUNKS__ variable insertion #119

@oblador

Description

@oblador

Description

When building a production bundle with repack, the resulting source map output is invalid. We tracked this down to being caused by the __CHUNKS__ code insertion in https://github.com/callstack/repack/blob/main/packages/repack/src/webpack/plugins/OutputPlugin.ts#L165-L172

When commenting it out, the source maps work again. My guess is that the hook compilation.hooks.afterProcessAssets is too late in the process or maybe that the ConcatSource is not the right way to inject it.

Reproducible Demo

cd packages/TesterApp
yarn react-native webpack-bundle --platform ios --entry-file index.js --bundle-output ./dist/main.jsbundle --dev=false
npx source-map-explorer ./dist/main.jsbundle

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions