Skip to content
This repository has been archived by the owner on Sep 9, 2021. It is now read-only.

Don't generate sourcemap for inline generation with fallback=false #193

Closed
wants to merge 1 commit into from

Conversation

ptlis
Copy link

@ptlis ptlis commented Mar 9, 2019

This PR contains a:

  • bugfix
  • new feature
  • code refactor
  • test update
  • typo fix
  • metadata update

Motivation / Use-Case

I'm using typescript, and with inline=true and fallback=false. I get a sourcemap being incorrectly generated for a js file that isn't created.

Breaking Changes

None that I'm aware of.

Additional Info

n/a

@jsf-clabot
Copy link

jsf-clabot commented Mar 9, 2019

CLA assistant check
All committers have signed the CLA.

@shockey
Copy link

shockey commented Jul 24, 2019

I needed this PR, ended up writing a plugin that achieved something similar:

class RemoveSourcemapsLackingMatchingAssetsPlugin {
  apply(compiler) {
    // Specify the event hook to attach to
    compiler.hooks.emit.tap(
      'RemoveSourcemapsLackingMatchingAssetsPlugin',
      (compilation) => {
        const assetNames = Object.keys(compilation.assets)

        const sourcemapAssetNames = assetNames.filter(str => str.endsWith(".map"))

        const sourcemapAssetsWithoutMatchingSourceAsset = sourcemapAssetNames.filter(name => {
          return assetNames.indexOf(
            name.slice(0, -4)
          ) === -1
        })

        sourcemapAssetsWithoutMatchingSourceAsset.forEach(name => {
          console.warn(`RemoveSourcemapsLackingMatchingAssetsPlugin: blocking emission of "${name}"`)
          delete compilation.assets[name]
        })
      }
    )
  }
}

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