-
Hi there, I have a problem where I cannot build, I've tried various things but really at a loose end - how do I get around this issue? Any help would be much appreciated!
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
The only way I can get it to build is if I change the name of either layout/theme.liquid or /scripts/layout/theme.js - which of course breaks the bundles. |
Beta Was this translation helpful? Give feedback.
-
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! |
Beta Was this translation helpful? Give feedback.
-
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
Optionally if you want to keep shared bundles you could add this function globally in layout and call it in templates: layout.theme.js
template.product.js
|
Beta Was this translation helpful? Give feedback.
@qedric
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
Optionally if you want to keep shared bundles you could add this function globally in layout and call it in templates:
layout.theme.js