Skip to content
This repository has been archived by the owner on Apr 20, 2018. It is now read-only.

The default js flow should concat or uglify but not both #611

Open
beck opened this issue Dec 23, 2015 · 1 comment
Open

The default js flow should concat or uglify but not both #611

beck opened this issue Dec 23, 2015 · 1 comment
Labels

Comments

@beck
Copy link

beck commented Dec 23, 2015

By default here is the sample of generated config:

  concat:
  { generated:
   { files:
      [ { dest: '.tmp/concat/app.js',
          src: [ 'src/js/a.js', 'src/js/b.js', 'src/js/c.js' ] } ] } }

  uglify:
  { options: { sourceMap: true },
  generated: { files: [ { dest: 'dist/app.js', src: [ '.tmp/concat/app.js' ] } ] } }

The concat is unnecessary because uglify can take multiple sources.

There are also has negative side-effects, when enabling uglify sourcemaps, you get:

{
  "version": 3,
  "sources": ["../.tmp/concat/app.js"],
  "names": ["yo", "Error", "aye", "document", "write", "bee", "console", "log"],
  "mappings": "AASA,QAASA,MACP,KAAM,IAAIC,OAAM,SATlB,GAAIC,KAAM,UACVC,UAASC,MAAMF,IAGf,IAAIG,KAAM,eACVF,UAASC,MAAMC,KAQfC,QAAQC,IAAI,OAEZD,QAAQC,IAAI,QAEZP",
  "file": "app.js"
}

Note sources, this is a bummer: ../.tmp/concat/app.js

When disabling the concat, the generated config is just:

  uglify:
  { options: { sourceMap: true },
  generated:
   { files:
      [ { dest: 'dist/app.js',
          src: [ 'src/js/a.js', 'src/js/b.js', 'src/js/c.js' ] } ] } }

And the sourcemap is correct:

{
  "version": 3,
  "sources": ["../src/js/b.js", "../src/js/a.js", "../src/js/c.js"],
  "names": ["yo", "Error", "aye", "document", "write", "bee", "console", "log"],
  "mappings": "AAKA,QAASA,MACP,KAAM,IAAIC,OAAM,SCLlB,GAAIC,KAAM,UACVC,UAASC,MAAMF,IDDf,IAAIG,KAAM,eACVF,UAASC,MAAMC,KEDfC,QAAQC,IAAI,OAEZD,QAAQC,IAAI,QAEZP",
  "file": "app.js"
}
@jgogstad
Copy link

Is there any reason to use concat at all? Can it be removed from the flow?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants