LwcWebpackPlugin with AliasModuleRecord for lwc.dev isn't loading HTML file for component

Viewed 25

I use LwcWebpackPlugin to load Lightning Web Components. Everything works fine but because I want to load compoennts from 'lwc' direcotry the namescape won't work. I must get components from /lwc directory and I bypysed this with AliasModuleRecord (described here) where I import all components by name. Problem is that only JS file is loading. Browser don't throw any exception but HTML body is not rendered. I know that JS file works because console log from connectedCallback is showed in browser console. What I'm doing wrong?. Maybe I haven't imported some library? Here is fragment form my webpack.config.js:

new LwcWebpackPlugin({
    modules: [
        { dir: 'src/modules' },
        { npm: 'lightning-base-components' },
        ...glob.sync(
            `./{${sfdxProjectJSON.packageDirectories?.map(package => package.path).join(',')}}/main/default/lwc/**/*.js`,
            { ignore: ['./**/__tests__/**'] }
        ).map(path => {
            const name = path.split('/').at(-2);
            return {
                "name": `c/${name}`,
                "path": path.replace('./', '')
            };
        }, {})
    ]
})

and this all resoults with:

[{
    name: 'ui/helloWorldExampleOne',
    path: 'pb-base/main/default/lwc/helloWorld/__docs__/examples/helloWorldExampleOne/helloWorldExampleOne.js'
},
{
    name: 'ui/helloWorld',
    path: 'pb-base/main/default/lwc/helloWorld/helloWorld.js'
},
{
    name: 'ui/exampleOne',
    path: 'pb-commerce/main/default/lwc/exampleOne/exampleOne.js'
}]
0 Answers
Related