Open David405 opened 3 years ago
What exactly happens when you tried? Exactly what errors did you get? In what way did you tweak webpack-config
?
Perhaps push your experiment to a branch and give a log of the exact errors?
visual studio finds the reference to ../participate in the import but when it is run the import is not found.
reference from what? "when run" how?
WHAT I DID 1
So I created a file called ballot.js
and I imported the function signIn
from participate.js
and getEthProvider
from rchain-api
, since I don't know how particpate.js
calls elements fromparticipate.html
, I manually required the script file ballot.js
inside ballot.html
as a module ( I know this is bad practice for an SPA, but it is only a temporal solution ). Also, inside of the wepack-config
file, I added ballot.html
as a HTMLWebpackPlugin
.
ERROR
So, manually requiring ballot.js
even as a module makes the browser unable to find rchain-api
or participate.js
.
WHAT I DID 2
I tried directly importing the signIn
function from participate.js
inside index.js and then did a getElementById of #signIn
button and added an event listener which calls the function.
ERROR
It doesn't look in ballot-ui
for the id signIn,
so the button does nothing.
NB - I created the signIn
function inside participate.js
as I didn't want to rewrite existing code, I simply reused the dependencies and methods already created inside participate.js
That all seems reasonable, @David405 . I might be able to reproduce your results, but it would take an hour or so, which I can't justify given other commitments.
If you push the exact code you're running (or attach it as a .zip or something) and share the exact diagnostics you see, I might be able to help in less time.
@dckc kindly check the pull request #250
@dckc I would really appreciate your assistance here, I want to be able to use
participate.js
functions insideballot-UI.
I tried tweaking thewebpack-config
but that didn't work, I cannot figure out how the elements inparticipate.html
were called insideparticipate.js.
I can see where these were mounted, but I can't see whether the IDs mounted belong inparticipate.html.
Creating a separate js file for
ballot-UI
would be redundant IMO, as the functions to be used byballot-UI
share a lot with the functions and dependencies insideparticipate.js