Wrong JS file content is shown when multiple js files are stored in sub folders

Issue #1217 resolved
Loeng Chen created an issue

Multiple modules js files can be stored in a folder. These files can be imported with a relative file path. Salesforce documentation

When I open a js file that is stored in a subfolder, then the content of the js file in the top folder is shown.


Reproduction steps

  • Create standard Lightning Web component with a js file. e.g "lwc/helloworld/helloworld.js
import { LightningElement, track } from 'lwc';
import { RemoteSiteService } from 'c/utils';

export default class HelloWorld extends LightningElement {
    @track greeting = '';
    @track remoteResponse = '';

    changeHandler(event) {
        this.greeting = event.target.value;

        var remoteSite = new RemoteSiteService();
        this.remoteResponse = remoteSite.callSite(this.greeting);
  • Create a new module js file in the top folder 'e.g. lwc/utils/utils.js'
export { RemoteSiteService } from './/dataService//remoteSiteService.js';
  • Try to create a new js file in subfolder 'e.g. lwc/utils/dataService/remoteSiteService.js' It was not possible to create new folder It was also not possible to create a new js file. I had to manually create this file
export class RemoteSiteService{


        return string;
  • When I try to open the file remoteSiteService.js, then the content of 'utils.js' is shown.

Comments (4)

  1. Scott Wells repo owner

    Fix submitted for inclusion in the next build. Note, however, that nesting of components is not supported. A single LWC component can only have one meta.xml file, and its directory structure should be flat under the component directory except for __tests__ sub-directories (or similar for other test frameworks).

  2. Scott Wells repo owner

    Delivered in As noted previously, files that match the current supported directory structure are included in the sub-tabs, and others that are nested in a fashion that's not currently adherent to the supported directory structure are opened as if they were standalone source files.

  3. Log in to comment