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

Can't build plugin from source #79

Closed
jlsiewert opened this issue Oct 22, 2021 · 2 comments
Closed

Can't build plugin from source #79

jlsiewert opened this issue Oct 22, 2021 · 2 comments

Comments

@jlsiewert
Copy link

Description

I tried to build the package from source. However, rollup warns about a circular dependency:

node_modules/glob/glob.js -> node_modules/glob/sync.js -> node_modules/glob/glob.js
node_modules/glob/glob.js -> node_modules/glob/sync.js -> node_modules/glob/glob.js?commonjs-proxy -> node_modules/glob/glob.js

The resulting main.js is 897 KB in size (compared to 1.33 MB in the released version).
Loading the plugin in obsidian fails:

Plugin failure: obsidian-pandoc-fixes TypeError: Cannot read property 'Glob' of undefined

Steps to Reproduce

To exclude some issues on main machine I tried to build the package in the node:lates docker image.

$ docker run -it --rm node:latest /bin/sh

# git clone https://github.com/OliverBalfour/obsidian-pandoc

# cd obsidian-pandoc

# npm i
added 47 packages, and audited 48 packages in 7s

# npm run-script build
> obsidian-pandoc-plugin@0.1.0 build
> rollup --config rollup.config.js --environment BUILD:production


main.ts → ....
(!) Unresolved dependencies
https://rollupjs.org/guide/en/#warning-treating-module-as-external-dependency
fs (imported by main.ts, renderer.ts, pandoc.ts, global.ts, node_modules/lookpath/lib/index.js, node_modules/temp/lib/temp.js, node_modules/rimraf/rimraf.js, node_modules/mkdirp/index.js, node_modules/glob/common.js, fs?commonjs-external, node_modules/fs.realpath/index.js, node_modules/fs.realpath/old.js)
path (imported by renderer.ts, main.ts, pandoc.ts, node_modules/lookpath/lib/index.js, node_modules/temp/lib/temp.js, node_modules/rimraf/rimraf.js, node_modules/mkdirp/index.js, node_modules/glob/glob.js, node_modules/glob/sync.js, node_modules/glob/common.js, path?commonjs-external, node_modules/minimatch/minimatch.js, node_modules/fs.realpath/old.js)
child_process (imported by pandoc.ts)
os (imported by node_modules/temp/lib/temp.js, os?commonjs-external)
constants (imported by node_modules/temp/lib/temp.js, constants?commonjs-external)
assert (imported by node_modules/rimraf/rimraf.js, node_modules/glob/glob.js, node_modules/glob/sync.js, assert?commonjs-external)
util (imported by node_modules/glob/sync.js, node_modules/glob/glob.js, node_modules/inherits/inherits.js, util?commonjs-external)
events (imported by node_modules/glob/glob.js, events?commonjs-external)
(!) Circular dependencies
node_modules/glob/glob.js -> node_modules/glob/sync.js -> node_modules/glob/glob.js
node_modules/glob/glob.js -> node_modules/glob/sync.js -> /obsidian-pandoc/node_modules/glob/glob.js?commonjs-proxy -> node_modules/glob/glob.js
created . in 2.7s

# ls main.js
-rw-r--r--  1 root root 896252 Oct 22 13:26 main.js

Any ideas on how to resolve this?

@kometenstaub
Copy link

You can build it with esbuild, that doesn't have this issue. It doesn't seem to be a real circular dependency (only an unused import), but rollup can't resolve it properly.

isaacs/node-glob#365, isaacs/node-glob#374

@frogkind frogkind mentioned this issue Jun 30, 2022
@OliverBalfour
Copy link
Owner

Fixed by #140

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

Successfully merging a pull request may close this issue.

3 participants