roman01la / webpack-closure-compiler

[DEPRECATED] Google Closure Compiler plugin for Webpack
MIT License
464 stars 25 forks source link

Building react.js with Advanced compilation gives error. #9

Closed tonis2 closed 8 years ago

tonis2 commented 8 years ago

Bundling works good but, browser gives error. Uncaught TypeError: (0 , f.default) is not a function from closure-compiler Faq i found

If you are using ADVANCED optimizations, you may also want to disable the type-based optimizations with --use_types_for_optimization false. Incorrect type optimizations can cause the compiler to make invalid assumptions

but where should i add this .--use_types_for_optimization false ?

roman01la commented 8 years ago

Hi, you should path this option into compiler configuration.

        new ClosureCompilerPlugin({
          compiler: {
            language_in: 'ECMASCRIPT6',
            language_out: 'ECMASCRIPT5',
            compilation_level: 'ADVANCED',
            use_types_for_optimization: false
          },
          concurrency: 3,
        })

Hope that helped.