Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for absolute paths #6

Closed
knorke132 opened this issue Jul 26, 2019 · 5 comments
Closed

Support for absolute paths #6

knorke132 opened this issue Jul 26, 2019 · 5 comments

Comments

@knorke132
Copy link

If your inheriting component is deeply nested inside your folder structure you may end up with an 'extends' statement looking like this:

<template extends="../../../../../../BaseComponents.vue">

which will break if you now move the child.

The BaseComponent should be accessable with an absolute path beginning from the root e.g.:
@/Widgets/BaseComponent.vue where '@/' points to 'src/'

@innocenzi
Copy link

I second this. I have an alias @ in Encore which leads to the root, it would be great if I could use it. Maybe using urlToRequest would help? Just a guess, I've never written a webpack loader.

I think the issues is around these lines :

if (currentDesc.template && currentDesc.template.attrs[options.EXTENDS_ATTR]) {
let baseRelPath = currentDesc.template.attrs[options.EXTENDS_ATTR];
let baseAbsPath = path.join(currPath, baseRelPath);

@mrodal
Copy link
Owner

mrodal commented Aug 24, 2019

Sorry for taking so long to answer.
When @knorke132 first posted I made a fix for this, but didnt uploaded it because it didnt work with the jest extension, since jest doesnt use the webpack aliases.. so the user should define the aliases both in webpack and jest.

I'll try to make it work with jest too and post here any updates

@mrodal
Copy link
Owner

mrodal commented Aug 26, 2019

I've uploaded a version on master, would you care to try it before I publish a new npm version?

Also, do any of you use this together with jest?

@xingtianyoulong
Copy link

xingtianyoulong commented Sep 7, 2019

@mrodal ,your job is very cool for Vue template extends, please publish this with a new npm version now. I use this successfully in nuxt,please publish lastest version include absolute @.

By the way,Is it true that we can not find any other official solution for Vue template extends function except your plugin?

@mrodal
Copy link
Owner

mrodal commented Sep 15, 2019

Well, it took me a long time but it's here, the new version is published (v0.1.7) please let me know if you encounter any problems!

@mrodal mrodal closed this as completed Sep 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants