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

181
Views
NuxtJS load cjs modules

I'm try to use third-party libraries in my NuxtJS project. This dependencies has cjs and mjs extensions.

Simple import

import { DataModel } from '@glazed/datamodel'
import { DIDDataStore } from '@glazed/did-datastore'

raised error:

ERROR  Failed to compile with 1 errors                                                                                            friendly-errors 16:55:12


ERROR  in ./node_modules/@glazed/datamodel/dist/lib.cjs                                                                           friendly-errors 16:55:12

Module parse failed: Unexpected token (1:1104)                                                                                     friendly-errors 16:55:12
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders

My nuxt.config.js file:

    transpile: [
      'dids',
      'did-jwt',
      '@glazed/tile-loader',
      '@glazed/did-datastore',
      '@glazed/datamodel', 
    ],
    extend(config) {
      ...
      config.module.rules.push({
        test: /\.mjs$/,
        include: /node_modules/,
        type: "javascript/auto",
      })
      config.module.rules.push({
        test: /\.сjs$/,
        include: /node_modules/,
        type: "javascript/auto",
      })
      ...

What's wrong?

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!