plugins: commonjs - Missing export (Error: ... is not exported by ...)
- Rollup Plugin Name: commonjs
- Rollup Plugin Version: 20.0.0
- Rollup Version: 2.56.3
- Operating System (or Browser): macOS
- Node Version: 16
- Link to reproduction (⚠️ read below): https://replit.com/@danielcgindi/rollup-plugin-repro-4
Expected Behavior
Should correctly export whatever is imported.
Actual Behavior
Weird and irrelevant export.
The piece of code (importDeclaration.module.info.code) that fails looks like this:
import * as commonjsHelpers from "�commonjsHelpers.js";
import { __exports as mongodb } from "\u0000/Users/user/git/server/node_modules/mongodb/index.js?commonjs-exports"
export default commonjsHelpers.commonjsRequire("/$$rollup_base$$/node_modules/mongodb/index.js", "/$$rollup_base$$/node_modules/mongodb");
@lukastaegert this looks like it’s originating from the latest refactor during the circular dependencies support. While mongodb cannot be rolled up normally as it has severe circular dependencies, it seems to not be able to be rolled up dynamically too due to this bug. It looks like this should have been a reexport of __exports or at least *.
I tried to look into this and have not found what causes this to compose in such a way.
It’s probably line 228 in index.js, but how do we make it play well with the other stuff that’s being shoved in there?
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 20
- Comments: 23 (1 by maintainers)
For anyone stuck at this problem: downgrading
@rollup/plugin-commonjsto v21 solves for me.Any updates on this issue? v24.0.0 and still has issue.
I also have this issue using vite --version:
vite/4.1.4 darwin-x64 node-v18.14.0vite dev server works. When i try to build i getRollupError:When i add
react-useto commonjsOptions.ignore, the error jumps to the next lib:What am i missing? Any hints on investigating this?
If anyone finds any additional solutions, please update the thread! I’m also facing the same issue and downgrading hasn’t helped either.
I’m having the same issue using vitejs when importing photoswipe.
There still seems to be the or at least a bug.
In Short: I am importing a lib that depends on axios/axios.
After updating to a version > 18 the import failed with
The requested module ... does not provide an export named 'exports'as mentioned here and in the related post here: #modernweb-dev/web#1700.
Following the discussion(s) in #1038 and updating to v20.0.4 (beta), I get the following (new) error, though:
Anyone any success? Problem still exists, even using the latest (beta) release v22.0.0-13
Same issue here with web-dev-server. v22 has the mentioned error and v21.1.0 just hangs:
<— Last few GCs —>
[8057:0x604c890] 384504 ms: Mark-sweep 2008.1 (2082.1) -> 1995.8 (2082.8) MB, 2674.3 / 0.0 ms (average mu = 0.178, current mu = 0.071) task scavenge might not succeed [8057:0x604c890] 386388 ms: Mark-sweep 2009.2 (2082.8) -> 1996.6 (2083.6) MB, 1741.4 / 0.0 ms (average mu = 0.136, current mu = 0.076) task scavenge might not succeed [8057:0x604c890] 388341 ms: Mark-sweep 2010.1 (2083.8) -> 1997.4 (2084.6) MB, 1736.1 / 0.0 ms (average mu = 0.125, current mu = 0.111) task scavenge might not succeed
<— JS stacktrace —>
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory 1: 0xb09c10 node::Abort() [node] 2: 0xa1c193 node::FatalError(char const*, char const*) [node] 3: 0xcf8dde v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node] 4: 0xcf9157 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node] 5: 0xeb09f5 [node] 6: 0xeb14d6 [node] 7: 0xebf9fe [node] 8: 0xec0440 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node] 9: 0xf23884 v8::internal::ScavengeJob::Task::RunInternal() [node] 10: 0xdb6f6b non-virtual thunk to v8::internal::CancelableTask::Run() [node] 11: 0xb77a54 node::PerIsolatePlatformData::RunForegroundTask(std::unique_ptr<v8::Task, std::default_deletev8::Task >) [node] 12: 0xb798b9 node::PerIsolatePlatformData::FlushForegroundTasksInternal() [node] 13: 0x1564956 [node] 14: 0x1577084 [node] 15: 0x15652a8 uv_run [node] 16: 0xa43dd5 node::SpinEventLoop(node::Environment*) [node] 17: 0xb4bdb6 node::NodeMainInstance::Run(node::EnvSerializeInfo const*) [node] 18: 0xacd592 node::Start(int, char**) [node] 19: 0x7b8494a8fd0a __libc_start_main [/lib/x86_64-linux-gnu/libc.so.6] 20: 0xa4067c [node] Aborted (core dumped)
I’m also having the same problem. v22 gives me the error about
commonjsHelpers.jswhile v21 causeswtrto hang and eventually crash due to running out of memory. This is on a hello-world demo with a single test just to try to getwtrworking.