Apparently, nobody succeeded. I already spend a co...
# javascript
g
Apparently, nobody succeeded. I already spend a couple of hours on it without success so I keep my gradle
populateNodeModules
task. But I think I miss something. See https://youtrack.jetbrains.com/issue/KT-20210
a
What is the problem you are facing right now? DCE plugin not copying files, or the setup not working with the resulting layout?
g
DCE is copying files in
kotlin-js-min
. No problem here. But I thought that using kotlin-dce with devmode set to true could be used to remove the
populateNodeModules
task that we find in a lot of kotlin/JS project. But I cannot make my build working without a
node_modules
directory.
a
I see. That's because
node_modules
name is special - NodeJs (and browserify) treat such directories as a place where to get modules from (e.g kotlin.js)
g
Exactly.
a
Could you try passing
paths
option to browserify (e.g. https://github.com/vigetlabs/blendid/issues/17)
g
I tried without success.
I already spend time on it and the existing solution using
populateNodeModules
is working so there is no problem here. I was just asking in case a better solution was working.
a
Ok. Two last questions: 1) Have you tried replacing populateNodeModules with creating a symlink to the DCE output folder? 2) Just to be clear, have you tried to pass DCE output folder like this: https://github.com/bpmn-io/bpmn-js/blob/master/test/config/karma.unit.js#L73
I've tried renaming
node_modules
to
someDirectory
in the populateNodeModules task in your repository. The tests failed to launch as expected. Adding
browserify: { paths: ['build/someDirectory'] },
to the karma.conf.js solved the problem.
So I think it should be possible to use DCE devMode output folder in a similar manner
g
Yes, you’re right. I did it a first time but forgot to put the TWO paths:
paths: ['build/kotlin-js-min/test', 'build/kotlin-js-min/main']
Now, it’s working. 👏👌
Thanks for make me try again 😉
I thought I tried every configuration, but no.
a
👍
Could you post a link to the fixed config in the channel after you push it? So that people wouldn't miss the solution?
g
I will. I’m currently facing some new issues. I’m digging 😅
a
Thanks! 😃
g
Ok, so it’s working for karma with browserify but… it’s another story for mocha without karma (which I also have when I don’t need a browser). And googling “Mocha cannot find moduls” returns 34k results. I give up and keep my gradle copy task for the moment.
a
Mocha without karma relies on NodeJs to load the modules. You could either set NODE_PATH environment variable, or use something like app-module-path
g
It’s an endless story.
a
😞
g
Note: On Windows, NODE_PATH is delimited by semicolons instead of colons.
a
Yeah =(
g
It means it won’t work easily on both platform. The populateNodeModules task seems the best option.