calvinmetcalf / rollup-plugin-node-globals

90 stars 22 forks source link

Does the usage of rollup-plugin-node-globals increase the size of the distributed module? #27

Open kopax opened 5 years ago

kopax commented 5 years ago

I have written a node plugins, and I have the following error:

Error: 'existsSync' is not exported by node_modules/rollup-plugin-node-builtins/src/es6/empty.js
src/index.js → dist/@scope/docx2latex.min.js...
(!) Circular dependency: node_modules/rollup-plugin-node-builtins/src/es6/readable-stream/duplex.js -> node_modules/rollup-plugin-node-builtins/src/es6/readable-stream/readable.js -> node_modules/rollup-plugin-node-builtins/src/es6/readable-stream/duplex.js
(!) Circular dependency: node_modules/rollup-plugin-node-builtins/src/es6/readable-stream/duplex.js -> node_modules/rollup-plugin-node-builtins/src/es6/readable-stream/writable.js -> node_modules/rollup-plugin-node-builtins/src/es6/readable-stream/duplex.js
[!] Error: 'existsSync' is not exported by node_modules/rollup-plugin-node-builtins/src/es6/empty.js
https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module
src/docx2latex/convert-docx2latex.js (2:9)
1: import execa from 'execa';
2: import { existsSync } from 'fs';
            ^
3: import { join } from 'path';
4: import logger from 'debug';
Error: 'existsSync' is not exported by node_modules/rollup-plugin-node-builtins/src/es6/empty.js
    at error (/home/dka/workspace/git.myprivate.com/myorg/docx2latex/node_modules/rollup/dist/rollup.js:10149:30)
    at Module.error (/home/dka/workspace/git.myprivate.com/myorg/docx2latex/node_modules/rollup/dist/rollup.js:14132:9)
    at handleMissingExport (/home/dka/workspace/git.myprivate.com/myorg/docx2latex/node_modules/rollup/dist/rollup.js:14051:21)
    at Module.traceVariable (/home/dka/workspace/git.myprivate.com/myorg/docx2latex/node_modules/rollup/dist/rollup.js:14443:17)
    at ModuleScope.findVariable (/home/dka/workspace/git.myprivate.com/myorg/docx2latex/node_modules/rollup/dist/rollup.js:13141:39)
    at FunctionScope.findVariable (/home/dka/workspace/git.myprivate.com/myorg/docx2latex/node_modules/rollup/dist/rollup.js:2981:38)
    at ChildScope.findVariable (/home/dka/workspace/git.myprivate.com/myorg/docx2latex/node_modules/rollup/dist/rollup.js:2981:38)
    at FunctionScope.findVariable (/home/dka/workspace/git.myprivate.com/myorg/docx2latex/node_modules/rollup/dist/rollup.js:2981:38)
    at ChildScope.findVariable (/home/dka/workspace/git.myprivate.com/myorg/docx2latex/node_modules/rollup/dist/rollup.js:2981:38)
    at FunctionScope.findVariable (/home/dka/workspace/git.myprivate.com/myorg/docx2latex/node_modules/rollup/dist/rollup.js:2981:38)

This is related versions in my package.json:

    "rollup-plugin-babel": "^4.3.2",
    "rollup-plugin-cleanup": "^3.1.1",
    "rollup-plugin-commonjs": "^9.3.4",
    "rollup-plugin-inject": "^2.2.0",
    "rollup-plugin-json": "^4.0.0",
    "rollup-plugin-node-builtins": "^2.1.2",
    "rollup-plugin-node-resolve": "^4.2.4",
    "rollup-plugin-replace": "^2.2.0",
    "rollup-plugin-terser": "^4.0.4",
    "rollup-plugin-visualizer": "^1.1.1",
    "rollup-watch": "^4.3.1"

I decided to use rollup-plugin-node-globals and now the error is gone,

So I wonder, can I use by default rollup-plugin-node-globals even in web project or it will increase the size of the distributed module?