question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question: why aren't we allowed to make multiple shared entries?

See original GitHub issue

Hi,

Just today I noticed that in webpack-encore it’s impossible to create two shared entries? For example I’d like to have one for my frontend and one for my backend because different scripts will be on each area of my app but they will still be reused through each app’s respective area.

However in node_modules/@symfony/webpack-encore/lib/WebpackConfig.js:199

it’s throwing an exception createSharedEntry() cannot be called multiple times: you can only create *one* shared entry.

If I disable that check it creates the two shared entries with different names normally and they seem to work OK. Is there a specific reason not to create multiple shared entries?

Thanks in advance.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:8
  • Comments:24 (8 by maintainers)

github_iconTop GitHub Comments

5reactions
piotrantosikcommented, Jan 5, 2018

I’ll try. I hope that this help 😃

backend.acme.com - all files require jquery and bootstrap but backend_admin page has specified code available only for page administrators

.addEntry('backend', [
'./assets/js/backend/backend.js',
])
.addEntry('backend_admin', [
'./assets/js/backend/admin.js',
])
.createSharedEntry('backend_vendor', [
'jquery',
'bootstrap'
])

Every backend page:

<script src="{{ asset('build/backend_vendor.js') }}"></script>
<script src="{{ asset('build/backend.js') }}"></script>

When admin visit backend page:

{{ parent() }}
<script src="{{ asset('build/backend_admin.js') }}"></script>

Another subdomain, support.acme.com, all page require jquery and moment:

.addEntry('support', [
'./assets/js/support/support.js',
])
.addEntry('support_logged', [
'./assets/js/support/support_logged.js',
])
.createSharedEntry('support_vendor', [
'jquery',
'moment'
])

Every support page:

<script src="{{ asset('build/support_vendor.js') }}"></script>
<script src="{{ asset('build/support.js') }}"></script>

When user is logged to support:

{{ parent() }}
<script src="{{ asset('build/support_logged.js') }}"></script>
1reaction
weaverryancommented, Nov 16, 2018

Hi guys!

Closing this issue. The reason is that the CommonsChunkPlugin was replaced by the SplitChunksPlugin, which the latest version of Encore supports. The way it splits is much more intelligent and highly configurable.

Cheers!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Formatting Answer Choices - Qualtrics
Attention: Allow Text Entry is not compatible with dropdown multiple choice questions. Adding & Removing Text Entry on Answer Choices. Select the answer...
Read more >
6 Google Forms settings you should know about - Zapier
Make sure everyone only submits one entry. By default, Google Forms don't collect email addresses. This is useful because people can respond ...
Read more >
Guide to table relationships - Microsoft Support
There are several reasons why you should create table relationships before you create other database objects, such as forms, queries and reports. Table ......
Read more >
How to Ask Great Questions - Harvard Business Review
We offer guidance for choosing the best type, tone, sequence, and framing of questions and for deciding what and how much information to...
Read more >
Share your calendar with someone - Google Support
Tip: To share a calendar that you don't own, you need to ask the owner to give you “Make changes and manage sharing”...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found