Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terser or Uglify doesn't execute inside a Conditional #3

Closed
dvprz opened this issue Aug 9, 2018 · 3 comments
Closed

Terser or Uglify doesn't execute inside a Conditional #3

dvprz opened this issue Aug 9, 2018 · 3 comments

Comments

@dvprz
Copy link

dvprz commented Aug 9, 2018

Am I misusing the api? Expected behavior is if the conditional is true the bundle gets minified...

My rollup config looks like this:

// rollup.config.js
...
import { terser } from 'rollup-plugin-terser'
import { argv } from 'yargs'

const isProduction = argv.configProd === true

export default [{
 ...
  plugins: [
    babel({ exclude: 'node_modules/**' }),
    commonjs(),
    resolve(),
    conditional(isProduction, [
      terser()
    ])
  ]
...
}]
@AgronKabashi
Copy link
Owner

AgronKabashi commented Aug 10, 2018

From what I can tell terser is built around an older version of the rollup API which uses transformBundle to transform the code. In rollup >=0.60 this has been renamed to transformChunk[1][2] which is the one conditional 2.x is hooking up to so this explains why terser isn't being run.

The odd thing is that the rollup CLI still sees transformBundle as a valid hook.

My suggestion is that you downgrade to v1.1 (npm i rollup-plugin-conditional@1.1 --save-dev) for now while I continue the investigation.

@dvprz
Copy link
Author

dvprz commented Aug 10, 2018

@AgronKabashi Thank you so much! Reverting to 1.1 did the trick.

@AgronKabashi
Copy link
Owner

Version 2.1.1 was just published and should handle this case now.

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

No branches or pull requests

2 participants