Hello everyone,
I have taken a whole day debugging this, I lost about half my hair too. Consider this following folder structure:
package_folder
|--- package.js
|--- client.js
|--- client
| |--- lib
| | |--- editor.js
| |--- views
| |--- editor.js
| |--- editor.html
This package is a wrapper for an in-house wysiwyg editor. lib/editor exports the editor object from which we create the editor instance.
I also have editor.js and editor.html in my views folder which will be the template that will be used by the packageās users. We want both to expose the template and the libās editor, so in client.js which is my api.mainModule
I wrote this
import {Waggle_Editor} from './client/lib/editor.js'
import './client/views/editory.js'
export {Waggle_Editor};
So far so good huh? Well I thought so too! But on the application, the template was not declared and created a template not found error. I tried added/removing stuff in onRendered
or onCreated
but nothing did it. I tried adding the html file to client.js
and then I could see my html, but no javascript was ran on it, just as if views/editor.js
never got importedā¦
So I got sick of it and continued my way onto another package I needed to create, it had a very similar setup and everything was working fine! So I copy/paste most contents to make sure it was identical, then pointed to the files I wanted to and still no joy.
It turns out that renaming the file corrected this behaviorā¦ So by just renaming editor.js to editor1.js and fixing the related imports, everything worked.
So my question is this: Is this a normal behaviour? Have I overlooked something in the docs, or in my files (which are slightly bigger than the example) I have not tried to reproduce on an empty package but Iām pretty confident that it would do the same.