nuxt / module-builder

Complete solution to build and ship Nuxt modules.
MIT License
211 stars 22 forks source link

Unable to use `addLayout` function when writing Vue components in `TSX` files #292

Open alSergey opened 1 week ago

alSergey commented 1 week ago

Describe the bug

I cannot include a file without an extension in addLayout function, otherwise the following error will occur when running the npm run prepack command:

ℹ Building my-module
ℹ Cleaning dist directory: ./dist 
Could not map moduleDetection force

ERROR  Template not found: /Users/seralekhin/Desktop/simple-module/src/runtime/layouts/auth    

If I try to specify the js extension, the npm run prepack command also fails with an error:

ℹ Building my-module
ℹ Cleaning dist directory: ./dist
Could not map moduleDetection force

ERROR  Template not found: /Users/seralekhin/Desktop/simple-module/src/runtime/layouts/auth.js  

If I try to specify the tsx extension, the npm run prepack command succeeds, but then there is a problem in the project:

ERROR  Cannot start nuxt:  Template not found: /Users/seralekhin/Desktop/simple-module/dist/runtime/layouts/auth.tsx

Reproduction

Open StackBlitz and go to dist/module.mjs