Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is-mergeable-object is a devDependency but used in index.js #245

Open
tdeekens opened this issue Mar 26, 2022 · 7 comments
Open

is-mergeable-object is a devDependency but used in index.js #245

tdeekens opened this issue Mar 26, 2022 · 7 comments

Comments

@tdeekens
Copy link

When using pnpm and building using preconstruct I stumbled across noticing that is-mergeable-object is a devDep in this project while it's being used also in the index.js.

Should it be promoted to be a regular dependency?

@RebeccaStevens
Copy link

I believe this library bundles all it's dependencies.

@tdeekens
Copy link
Author

Thanks for the quick response. The error I am receiving looks as follows

> preconstruct build

node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module 'is-mergeable-object'
Require stack:
- /<path>/flopflip/node_modules/.pnpm/[email protected]/node_modules/deepmerge/index.js
- /<path>/flopflip/node_modules/.pnpm/@[email protected][email protected]/node_modules/@rollup/plugin-node-resolve/dist/cjs/index.js
- /<path>/flopflip/node_modules/.pnpm/@[email protected]/node_modules/@preconstruct/cli/cli/dist/cli.cjs.dev.js
- /<path>/flopflip/node_modules/.pnpm/@[email protected]/node_modules/@preconstruct/cli/cli/dist/cli.cjs.js
- /<path>/flopflip/node_modules/.pnpm/@[email protected]/node_modules/@preconstruct/cli/bin.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:999:19)
    at require (/<path>/flopflip/node_modules/.pnpm/[email protected]/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at Object.<anonymous> (/<path>/flopflip/node_modules/.pnpm/[email protected]/node_modules/deepmerge/index.js:1:94)
    at Module._compile (/<path>/flopflip/node_modules/.pnpm/[email protected]/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1151:10)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:999:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/<path>/flopflip/node_modules/.pnpm/[email protected]/node_modules/deepmerge/index.js',
    '/<path>/flopflip/node_modules/.pnpm/@[email protected][email protected]/node_modules/@rollup/plugin-node-resolve/dist/cjs/index.js',
    '/<path>/flopflip/node_modules/.pnpm/@[email protected]/node_modules/@preconstruct/cli/cli/dist/cli.cjs.dev.js',
    '/<path>/flopflip/node_modules/.pnpm/@[email protected]/node_modules/@preconstruct/cli/cli/dist/cli.cjs.js',
    '/<path>/flopflip/node_modules/.pnpm/@[email protected]/node_modules/@preconstruct/cli/bin.js'
  ]
}

@RebeccaStevens
Copy link

If you need a quick fix, I'd recommend deepmerge-ts

@tdeekens
Copy link
Author

Ok. I moved over the merge-deep which works for me.

@GongT
Copy link

GongT commented Aug 31, 2022

I confirm this issue(?)

to solve: (one of)

  1. rename index.d.ts to public.d.ts (or any other), and set "types": "./public.d.ts" in package.json
  2. add index.js to .npmignore

Why:

  • typescript language server index symbols, it found symbol deepmerge in deepmerge/index.d.ts
  • because there is a "index.js", it remember "index.js provides symbol deepmerge", which is wrong
  • when someone type "deepmerge" and call auto-complate in their editor, it emits import deepmerge from 'deepmerge/index';

when "types" in package.json, TSLS will know "the package named deepmerge provides symbol deepmerge"

@jorenbroekema
Copy link

Erh yeah is-mergeable-object most definitely should be a depedency, not a devDependency...
https://github.com/TehShrike/deepmerge/blob/master/index.js#L1

https://github.com/TehShrike/deepmerge/blob/master/index.js#L78

@Dinhero21
Copy link

Dinhero21 commented Feb 24, 2024

This generated a faulty bundle when building with Rollup.

Relevant logs:

(!) Missing global variable name
https://rollupjs.org/configuration-options/#output-globals
Use "output.globals" to specify browser global variable names corresponding to external modules:
is-mergeable-object (guessing "require$$0")

fixable by installing is-mergeable-object, but would have already been installed if included in package.json's dependencies (and not devDependencies)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants