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

Resolve alias is not working #412

Closed
yrq110 opened this issue Aug 27, 2019 · 3 comments
Closed

Resolve alias is not working #412

yrq110 opened this issue Aug 27, 2019 · 3 comments

Comments

@yrq110
Copy link

yrq110 commented Aug 27, 2019

In _scripts/webpack.renderer.config.js.

...
 '@': path.join(__dirname, './src/'),
...

should be

...
 '@': path.join(__dirname, '../src/renderer'),
...

and for example the code below will working

import SystemInformation from '@/components/About/SystemInformation.vue'
...

Same problem with src alias and config in _scripts/webpack.main.config.js

@mubaidr
Copy link
Owner

mubaidr commented Aug 27, 2019

Well the purpose for the current settings was to make same alias available for all type of scripts, whether its main, renderer or worker.

Does this not work?

import SystemInformation from '@/renderer/components/About/SystemInformation.vue'

@yrq110
Copy link
Author

yrq110 commented Aug 27, 2019

Ok I got it.

It's not working, the error info is:

./src/renderer/components/Help.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./src/renderer/components/Help.vue?vue&type=script&lang=js&)
Module not found: Error: Can't resolve '@/renderer/components/About/SystemInformation.vue' in '/Users/yrq/Desktop/project/vue-electron/src/renderer/components'

If change @ value to path.join(__dirname, '../src/'), it works.

@mubaidr
Copy link
Owner

mubaidr commented Aug 27, 2019

Thanks, I have updated the resolve path.

65aebf9

@mubaidr mubaidr closed this as completed Aug 27, 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

2 participants