merge a third-party dependencies into bundle files is not working
Open
Nobody has claimed this yet.
💩 template removed
c⁵ ⋅ question
- Dominant language
- JavaScript
- Stars
- 26.3k
- Forks
- 1.8k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 20
Description
I want to merge the third dependency into the bundle file. According to the configuration of the official website, it does not take effect.
here is my code
rollup.config.js
import resolve from "rollup-plugin-node-resolve";
import commonjs from "rollup-plugin-commonjs";
export default {
input: "index.js",
output: {
file: "main.js",
format: "iife"
},
plugins: [
resolve({ mainFields: ["jsnext", "module", "main"],
}),
commonjs({
include: "node_modules/**"
})
]
};
index.js
import { CanvasRoot } from "react-webgl";
const cr = new CanvasRoot();
But when I bundle the file, I get thoese information

Here is the bundle file
main.js
(function (reactWebgl) {
'use strict';
const cr = new reactWebgl.CanvasRoot();
}(reactWebgl));
This has bothered me for two days,any tips wille be appreciated
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the configuration shown in rollup.config.js and the import in index.js, then inspect the generated main.js. Reproduce the bundle and compare the output with the stated goal of including the react-webgl dependency rather than leaving reactWebgl as an external reference.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100