-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
[Parcel 2]: Bundle group cannot have more than one entry bundle of the same type #6310
Comments
No, unfortunately this was not the problem :( Everytime when I inport the same file in more than one entrypoint, I got this message. |
Please provide a complete code example that produces this error |
That is, what causes the problem:
|
Is there a command or cli parameter to debug where exactly it crashes? |
Can somebody explain in which cases the message „Bundle group cannot have more than one entry bundle of the same type“ appears? Still looking for a solution :( |
Hi together, I have uploaded a simplyfied version of my code which is not usable with parcel 2. My parcel cli command is: The following link opens Google Drive (directory listing + download option): https://drive.google.com/file/d/12A43L1qET1WjhY_uVGglF4yXAqzZTvfr/view?usp=sharing I don't know if I do something wrong or this is a parcel 2 bug. In parcel 1 this example runs without any errors. Thanks for your help! |
It seems to be the same problem as described in #5074 |
I tried converting a project back to Parcel and am running into this. :-/ The output is really unhelpful, so I'm at a loss. Repro: git clone https://github.com/cubing/cubing.js && cd cubing.js
git checkout parcel-yet-again-again # 4a71add2091da6ab46dbf493f83a16d6d4d71428
npm install
make build-search-worker
npx parcel build src/sites/experiments-cubing-net/cubing-js/index.html Output:
Note that this works just fine for development: npx parcel serve src/sites/experiments-cubing-net/cubing-js/index.html (Also, the build process (but not the dev server) also runs into issues when folders have periods, so I renamed them for this repro.) |
I'm guessing this is a similar issue to FredKSchott/snowpack#3414 where periods in a folder throw off a file type heurisic.
This is still a major issue for us. I just tried |
Same here. Major issue. We can't update :'( |
I'm guessing this is a similar issue to FredKSchott/snowpack#3414 where periods in a folder throw off a file type heurisic.
My files(entry points) were in the /src/pages/ folder and I was getting the this error, but when I moved all the entry points to /src/ it worked. I waiting fix. before: "build": "parcel build src/pages/.jsx " |
In the meantime it is the end of 2021 and there is still no feedback. We still have to use Parcel 1 because of this bug. I have uploaded a code example to My Parcel command is: Please help! We would love to update to Parcel 2. |
In @TobiasSchikora's case the problem is that it generates a shared CSS bundle, and one CSS bundle specific to just one of the entries. |
How does Parcel 1 handle this? (There are no problems). Do you think that this issue can be solved? I really love Parcel. |
Apparently it doesn't create a shared bundle. |
Do you have any - maybe the same - browserlist/target configurations? package.json
|
Is there a way to avoid this error? I have this package.json targets with no other directives than package dependencies,
and both of bundle.js have these lines
The former is a shared style files pointing to a same folder for both targets and the latter is local style files which differs for each targets. Funny thing is that if there are no files in the local |
Just ran into this as well. My setup is a bit different. I was trying to use a glob pattern to build multiple
This gave the error above. The same thing occurs if I have a single |
Same issue for me as well with parcel 2.6.2 cli modules/a.js import "./styles/a.scss
import * as helper from "components/helper";
helper.helper(); modules/b.js import "./styles/b.scss
import * as helper from "components/helper";
helper.helper(); components/helper.js import "./x-scroll.scss";
exports.helper = () => {}
exports.helper(); When I remove the scss import from either a.js or b.js the error goes away. |
It seems that there is no interest to fix this :'( |
@mischnic - do you have thoughts on a workaround (somehow disable shared bundles) or some indication if this would be addressed? Happy to help in any way I can! |
I came across this issue when debugging a similar problem: I have two targets with different sources; js modules imported into each source were added to a shared bundle and only written to the output directory of the first target. I was able to work around the problem by increasing the value of This doesn't fix the original bug report, though I did get @TobiasSchikora's example to run by inlining the shared css import using |
I have this problem migrating a project to Parcel 2 as well. I'm not familiar with the project's entry points, but based on @2silver hint, I naively removed the |
I'm also facing this issue. The scenario is a bit different, but it's probably the same cause. I have several sources defined in "source": [
"src/appsEntries/app1.ts",
"src/appsEntries/app2.ts",
"src/appsEntries/app3.ts"
] Now I have two React files:
In // Layout.tsx
import "./common.styles.scss"; and in // Component.tsx
import "../../assets/another.scss"; when building with parcel I'm getting an error:
I'm attaching a sample app which reproduces this error: Run This is problematic, as it doesn't allow splitting styles in this use scenario 😥 |
For what it's worth, I've changed to Vite which seems to support this relatively easily. Here's my import {defineConfig} from 'vite'
import react from '@vitejs/plugin-react-swc'
import * as path from "path";
// https://vitejs.dev/config/
export default defineConfig(({mode}) => ({
plugins: [react()],
build: {
manifest: true,
rollupOptions: {
input: {
foo: __dirname + '/src/foo/index.tsx',
bar: __dirname + '/src/bar/index.tsx',
// ...etc
},
},
},
})) We have a dozen or so entry points and it's all straightforward. |
We also unfortunately moved to Vite. |
#9023 might fix this issue also. |
Any progress on this? Running into the same issue: "Bundle group cannot have more than one entry bundle of |
Hate to say it, but my solution was just to move to Vite |
For now, I'm bypassing the issue by creating a separate file that imports the file I'm after. Using @TobiasSchikora 's filename examples, assets/src/shared still contains the shared things I want in both aaa and bbb, but I don't import them directly into assets/src/desktop/aaa.js and assets/src/desktop/bbb.js: instead, assets/src/desktop/aaa.js imports assets/src/desktop/aaa-shared.css and assets/src/desktop/bbb.js imports assets/src/desktop/bbb-shared.css, both of which are simply: @import "../shared/*.css"; Parcel seems fine with this since both imports get to the same files via different paths 🤷♂️ It works for my use case which is just for reused CSS files (haven't tried this with JavaScript), though it's a bit ugly, and may not work for more complex needs. Still, it lets me just write my shared code once and import into aaa and bbb (with only a couple new lines/files I set up once and don't need to touch again) which is what I'm after. |
#9023 is still being reviewed but I'm hopeful it'll fix this issue. I'm in the process of testing out the patch with one of our exhibiting codebases. I'll report back when I have a result. |
any news here? After 2,5 years parcel still doesn't support two .scss files in the same project... |
Unfortunately not. And I don't think that will ever happen. We are currently in the process of porting our projects to other bundlers. This is really very sad. |
Sorry I forgot to report back. #9023 didn't fix the issue for me. I intend to find a solution to this issue since other bundlers can't scale for us the way Parcel can. Not sure when I'll get the time to dig deeply on this one but it'll happen. |
Hi, |
With multiple JS entrypoints (e.g. Now Parcel tries to create shared bundles for CSS. Then one of the following can happen:
If I remember correctly, this should cover all of the cases I've seen so far. EDIT: The reason that not everyone runs into this bug is that if you use HTML entries with Parcel, this works fine because there is no restriction to have deterministic names and so 2 CSS shared bundles are fine. The code that determines which bundles are created and which files get put into which bundle is the bundler (docs). As far as I can tell, Parcel doesn't actually create shared JS bundles across entry points, so not creating shared CSS bundles might be a solution here. @devongovett Any thoughts? |
@mischnic Thanks for your patient and kind response! I would like to add our situation for your information: In rustc-perf, I believe we encountered case 3. In short, the rustc-perf frontend has two entry points, flowchart LR
entry1.js -- use --> c["`
A.js with scoped CSS
B.js without CSS
`"]
entry2.js -- use --> c
According to my observation, the shared My inference is although Parcel 2 doesn't actually create shared JS bundles, it successfully ensures that the shared JS is added to their respective bundles smoothly. The issue appears to be caused solely by the CSS part. Perhaps a method could be found to ensure that CSS can be added to their respective bundles, just like JS component itself. |
One thing I should have noted in my comment: the reason that not everyone runs into this bug is that if you use HTML entries with Parcel, this works fine because there is no restriction to have deterministic names and so 2 CSS shared bundles are fine. |
I tried it again and now it works! Thank you very much for supporting it ♥ |
🐛 bug report
Hi together,
I am switching from Parcel 1 to Parcel 2 with a larger project. With Parcel 1 there are no problems. Parcel 2 shows the following error message:
Bundle group cannot have more than one entry bundle of the same type
.My entrypoints are
assets/src/*/*.js
. There are 3 folders insrc
:mobile
,desktop
andshared
. When I try to import the same file fromassets/src/shared
folder inassets/src/desktop/aaa.js
as well as inassets/src/mobile/bbb.js
, then the error occurs.I saw the following code part:
which aborts the bundle. Why? And why does this work in parcel 1 without any problems? What can I do?
🎛 Configuration (.babelrc, package.json, cli command)
There is no difference if I use the
--dist-dir
cli option or thetarget
inpackage.json
.🤔 Expected Behavior
The bundle should be created without any error messages. The files which were shared between desktop and mobile entrypoints should be in both entry output files. Parcel 1 does exactly what I expected.
😯 Current Behavior
The bundle aborts with an error message as follows:
🔦 Context
I try to share some modules between desktop and mobile (different) entrypoints. I have much entrypoints which are sharing some modules.
💻 Code Sample
assets/src/desktop/main.js
import '../shared/components/autologin';
assets/src/mobile/main.js
import '../shared/components/autologin';
assets/src/shared/components/autologin.js
// some code
🌍 Your Environment
The text was updated successfully, but these errors were encountered: