Currently trying to use the compress.js package to compress and image in nuxtjs.
But when it import it into the <script> tag it gives me an error. Cannot use import statement outside a module.
import Compress from "compress.js";
I tried adding it to the plugins directory and in nuxt.config.js like this.
nuxt.config.js
plugins: [
{ src: "~/plugins/compress-js.js", mode: "client" }
],
compress-js.js
import Vue from "vue";
import Compress from "compress.js";
Vue.use(new Compress());
But the error still comes. Any help would be appreciated.