Skip to content

Cannot build! #77

Answered by hayes0724
qedric asked this question in Q&A
Apr 12, 2021 · 3 comments · 1 reply
Discussion options

You must be logged in to vote

@qedric

It seems if I am importing the same module in two different files, then this issue occurs - how do I get around this? Of course there are scenarios where multiple js files need to use the same imports!

It's a webpack 5 optimization issue

You can share files on template entrypoints, this error only appears if you to try to share on layout and template entrypoint like your above example with layout.theme.js + template.product.js

The quick fix is this setting which disables shared bundles

module.exports = {
  'build.sharedBundles': false,
}

Optionally if you want to keep shared bundles you could add this function globally in layout and call it in templates:

layout.theme.js

import …

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@qedric
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by qedric
# for free to join this conversation on GitHub. Already have an account? # to comment
Category
Q&A
Labels
None yet
2 participants