Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

284
Views
How to use npm packages in nuxtjs currently trying to use compress.js

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.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!