I used to uglify and hash my js files. Then I wanted to rewrite my js file using es6.
I only started with two files, search.js
and select.js
, (amongst dozens) that depend on each other.
My run the es6 conversion and then the uglify task.
grunt runs without errors.
When I try my website, in the browser console I see this error
Uncaught ReferenceError: exports is not defined
search.js
contains the es6 export
statement and select.js
contains the export
statement as well and the import
to import exported search.js
How do I fix this given that I'm using grunt and all my js files are aggregated into one final uglified file?
I've read this post, it gives great answers on what's going on but it does not suggests any grunt solution.