'Rollup 'is not exported' error prevents me from taking a build
I'm a novice at bundling tools and give a start with Rollup because we use it in corp. But when I want to build, it greets me with the following error:
yarn run v1.22.17
$ rimraf dist && tsc && rollup -c rollup.config.js
./out-tsc/unit/index.js → dist...
(!) Unresolved dependencies
https://rollupjs.org/guide/en/#warning-treating-module-as-external-dependency
fs (imported by out-tsc\unit\cached-git-repo.js)
child_process (imported by node_modules\simple-git\esm\index.js)
[!] Error: 'exists' is not exported by node_modules\@kwsites\file-exists\dist\index.js, imported by node_modules\simple-git\esm\index.js
https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module
node_modules\simple-git\esm\index.js (13:7)
11: for (var prop in b || (b = {}))
12: if (__hasOwnProp.call(b, prop))
13: __defNormalProp(a, prop, b[prop]);
^
14: if (__getOwnPropSymbols)
15: for (var prop of __getOwnPropSymbols(b)) {
Error: 'exists' is not exported by node_modules\@kwsites\file-exists\dist\index.js, imported by node_modules\simple-git\esm\index.js
at error (C:\Users\ibrah\WebstormProjects\versioned-projects-source-manager\node_modules\rollup\dist\shared\rollup.js:160:30)
at Module.error (C:\Users\ibrah\WebstormProjects\versioned-projects-source-manager\node_modules\rollup\dist\shared\rollup.js:12436:16)
at Module.traceVariable (C:\Users\ibrah\WebstormProjects\versioned-projects-source-manager\node_modules\rollup\dist\shared\rollup.js:12797:29)
at ModuleScope.findVariable (C:\Users\ibrah\WebstormProjects\versioned-projects-source-manager\node_modules\rollup\dist\shared\rollup.js:11419:39)
at FunctionScope.findVariable (C:\Users\ibrah\WebstormProjects\versioned-projects-source-manager\node_modules\rollup\dist\shared\rollup.js:6395:38)
at ChildScope.findVariable (C:\Users\ibrah\WebstormProjects\versioned-projects-source-manager\node_modules\rollup\dist\shared\rollup.js:6395:38)
at Identifier.bind (C:\Users\ibrah\WebstormProjects\versioned-projects-source-manager\node_modules\rollup\dist\shared\rollup.js:7684:40)
at CallExpression.bind (C:\Users\ibrah\WebstormProjects\versioned-projects-source-manager\node_modules\rollup\dist\shared\rollup.js:5284:23)
at CallExpression.bind (C:\Users\ibrah\WebstormProjects\versioned-projects-source-manager\node_modules\rollup\dist\shared\rollup.js:8866:15)
at ReturnStatement.bind (C:\Users\ibrah\WebstormProjects\versioned-projects-source-manager\node_modules\rollup\dist\shared\rollup.js:5284:23)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I'm on verge of going nuts. Because the website Rollup redirects me has nothing about it contrarily to what it claims to have. Could you help me to fix this issue? I don't think anything is wrong with config files, nevertheless, I shared them in the following if you want to check.
# package.json
{
"name": "versioned-projects-source-manager",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "rimraf dist && tsc && rollup -c rollup.config.js",
"test": "jest"
},
"author": "",
"license": "ISC",
"dependencies": {
"glob": "^7.2.0",
"simple-git": "^3.1.1"
},
"devDependencies": {
"@open-wc/building-rollup": "^2.0.1",
"@types/jest": "^27.4.0",
"@typescript-eslint/eslint-plugin": "^5.10.2",
"@typescript-eslint/parser": "^5.10.2",
"deepmerge": "^4.2.2",
"eslint": "^8.8.0",
"ini": "^2.0.0",
"jest": "^27.4.7",
"rimraf": "^3.0.2",
"rollup": "^2.67.3",
"ts-jest": "^27.1.3",
"typescript": "^4.5.5"
}
}
# rollup.config.js
import merge from 'deepmerge';
import { createBasicConfig } from '@open-wc/building-rollup';
const baseConfig = createBasicConfig();
export default merge(baseConfig, {
input: './out-tsc/unit/index.js',
output: {
dir: 'dist',
}
});
# tsconfig.json
{
"include": [
"./src/**/*.ts",
"./src/**/*.tsx"
],
"exclude": [
"./node_modules/**"
],
"compilerOptions": {
"target": "es2018",
/* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
"module": "esnext",
/* Specify what module code is generated. */
"moduleResolution": "node",
/* Specify how TypeScript looks up a file from a given module specifier. */
"lib": [
"es2017"
],
"sourceMap": true,
/* Create source map files for emitted JavaScript files. */
"outDir": "./out-tsc",
/* Specify an output folder for all emitted files. */
"esModuleInterop": true,
/* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */
"forceConsistentCasingInFileNames": true,
/* Ensure that casing is correct in imports. */
"strict": true,
/* Enable all strict type-checking options. */
"skipLibCheck": true
/* Skip type checking all .d.ts files. */
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
