Title: WP-Optimize Minify may break plugin ES module scripts using import statements
Last modified: May 30, 2026

---

# WP-Optimize Minify may break plugin ES module scripts using import statements

 *  [BlackStar](https://wordpress.org/support/users/blackstar1991/)
 * (@blackstar1991)
 * [1 week, 1 day ago](https://wordpress.org/support/topic/wp-optimize-minify-may-break-plugin-es-module-scripts-using-import-statements/)
 * Hi, I found a compatibility issue between WP-Optimize Minify and a WordPress 
   plugin that uses frontend ES module scripts.
 * The plugin enqueues a JavaScript file that contains ES module imports, so it 
   must be loaded with type=”module”. When WP-Optimize JavaScript minification/combination
   is enabled, the frontend animation script either does not load correctly or is
   processed in a way that causes the browser error:
 * **Uncaught SyntaxError: Cannot use import statement outside a module**
 * After excluding the plugin’s JS module files from WP-Optimize minification, the
   issue disappears and the animation works correctly.
 * Could you please check how WP-Optimize handles scripts registered with type=”
   module” or scripts modified through the script_loader_tag filter?
 * Affected files in my case:
 * Affected files in Timeline Full Widget 2.2.0:
    - [https://plugins.svn.wordpress.org/timeline-full-widget/tags/2.2.0/assets/js/adapters/gutenberg-adapter.js](https://plugins.svn.wordpress.org/timeline-full-widget/tags/2.2.0/assets/js/adapters/gutenberg-adapter.js)
    - [https://plugins.svn.wordpress.org/timeline-full-widget/tags/2.2.0/assets/js/core/animation.js](https://plugins.svn.wordpress.org/timeline-full-widget/tags/2.2.0/assets/js/core/animation.js)
 * Expected behavior:
   WP-Optimize should preserve type=”module” and avoid combining
   ES module scripts with regular scripts, or provide a reliable exclusion mechanism
   for module scripts. Thanks.

Viewing 1 replies (of 1 total)

 *  Plugin Support [jbgupdraft](https://wordpress.org/support/users/jbgupdraft/)
 * (@jbgupdraft)
 * [6 days, 11 hours ago](https://wordpress.org/support/topic/wp-optimize-minify-may-break-plugin-es-module-scripts-using-import-statements/#post-18925191)
 * Hi,
 * Thanks for reporting this! I will pass this along to our Product team to investigate
   and see if we can add something to our roadmap so that module scripts are excluded
   from the Minification and Merging process.
 * I’m glad to hear that manually excluding them allowed the scripts to function
   properly while still keeping the Minification and Merging enabled for other javascript
   files.
 * Thank you!

Viewing 1 replies (of 1 total)

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fwp-optimize-minify-may-break-plugin-es-module-scripts-using-import-statements%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/wp-optimize/assets/icon-256x256.png?rev=1552899)
 * [WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance](https://wordpress.org/plugins/wp-optimize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-optimize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-optimize/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-optimize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-optimize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-optimize/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [jbgupdraft](https://wordpress.org/support/users/jbgupdraft/)
 * Last activity: [6 days, 11 hours ago](https://wordpress.org/support/topic/wp-optimize-minify-may-break-plugin-es-module-scripts-using-import-statements/#post-18925191)
 * Status: not resolved