Skip to content

Library gives errors on build #59

@SyedHusaini

Description

@SyedHusaini

I have a Nuxt2 project and I installed and tested the library locally. Things seemed to work perfectly. But when I build my project, I get the following error(s):

ERROR  Failed to compile with 1 errors                                                                                                      friendly-errors 18:56:37


 ERROR  in ./node_modules/json-difference/dist/index.js                                                                                      friendly-errors 18:56:37

Module parse failed: Unexpected token (1:1247)                                                                                               friendly-errors 18:56:37
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
> "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=(e,f)=>{const o=[];for(const i in e)if(f.hasOwnProperty(i)){if(typeof e[i]=="object"&&typeof f[i]=="object"&&JSON.stringify(e[i])===JSON.stringify(f[i])||e[i]===f[i])continue;if(e[i]==="@{}"||e[i]==="@[]"){const n=f[i]==="@{}"?{}:f[i]==="@[]"?[]:f[i];e[i]==="@{}"?JSON.stringify(f[i])!=="{}"&&o.push([i,{},n]):JSON.stringify(f[i])!=="[]"&&o.push([i,[],n])}else o.push([i,e[i],f[i]])}return o},p=(e,f)=>{const o=[];let i=0;for(const n in e)if(!(n in f)){const r=e[n]==="@{}"?{}:e[n]==="@[]"?[]:e[n];o[i]=[n,r],i++}return o},O=(e,f,o,i)=>{const n=i?e?"[":".":"/",r=i?e?"]":"":e?"[]":"";return f==="__start__"?`${i&&e?"[":""}${o}${r}`:`${f}${n}${o}${r}`},s=(e,f=!1,o,i="__start__")=>{o===void 0&&(o=Array.isArray(e)?{__root__:"@[]"}:{__root__:"@{}"});for(const n of Object.keys(e)){const r=O(Array.isArray(e),i,n,f);typeof e[n]=="object"&&e[n]!==null?(Object.keys(e[n]).length===0?o[r]=e[n]:o[r]=Array.isArray(e[n])?"@[]":"@{}",s(e[n],f,o,r)):o[r]=e[n]}return o},c=e=>(e.edited=e.edited.filter(f=>!(typeof f[1]=="object"&&f[2]==="@{}")).map(f=>f[2]==="@{}"?[f[0],f[1],{}]:f[2]==="@[]"?[f[0],f[1],[]]:f),e),b={isLodashLike:!1},j=(e,f,o)=>{const{isLodashLike:i}=o??b,n={added:[],removed:[],edited:[]},r=typeof e=="string"?JSON.parse(e):e,_=typeof f=="string"?JSON.parse(f):f,y=s(r,i),g=s(_,i);return n.removed=p(y,g),n.added=p(g,y),n.edited=t(y,g),c(n)};exports.getDiff=j;exports.getEditedPaths=t;exports.getPathsDiff=p;exports.getStructPaths=s;
|

Node version is 20.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions