dynamically imported asset's published chunks path in imported compiled script #18318
Unanswered
shashank-brightness
asked this question in
Q&A
Replies: 1 comment 7 replies
-
Why you don't use |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, i am trying to import some html from template using dynamic import statement and hence webpack generates its chunk file in the output directory.
Let's say i am importing main.html as a promise and then pass this as parameter to some other function.
and for initHTML.js, this is how this promise is being used as
loadComponentHTML
which is this same functionloadMainHTML
which was passedand everything is working nicely and webpack published this chunk to separate out html from main file as
src_components_main_main_html.js
in the output directory. In my case public directory path is output instead of dist, so chunk is going thereBut the thing is that when i try to use compiled output of mypackage to consumer side (where compiled script is imported), then it is not finding the chunk url path correctly.
I am using laravel mix plugin in the project and i need to assign
publicPath
for that one script to output directory inside my package.How to set public path to the path of node_modules package file? so let's say if i import
public-path.js
before anything else i would like to set public path to one level up where output directory currently is.something like
__webpack_public_path__ = '../';
so when i import compiled file in consumer end, it points to output dir of package.
Beta Was this translation helpful? Give feedback.
All reactions