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

Webpack Alias path is not working on apollo-server #462

Open
IttisutBm opened this issue Nov 13, 2020 · 0 comments
Open

Webpack Alias path is not working on apollo-server #462

IttisutBm opened this issue Nov 13, 2020 · 0 comments

Comments

@IttisutBm
Copy link

IttisutBm commented Nov 13, 2020

vue-cli default config for webpack is including this.

config.resolve.alias.set('@', path.resolve(__dirname, './src/'))

so I use @ in import on the client-side. It is working perfectly

import { Role } from '@/utils/enum'

but when I use it in apollo-server (i use it in data-sources.js)
It is not working. I got error msg like this.

projectDir\node_modules\@vue\cli-service\bin\vue-cli-service.js
    at Object.<anonymous> (projectDir\apollo-server\data-sources.js:1) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'projectDir\\apollo-server\\data-sources.js',
    'projectDir\\node_modules\\vue-cli-plugin-apollo\\utils\\load.js',
    'projectDir\\node_modules\\vue-cli-plugin-apollo\\graphql-server\\index.js',
    'projectDir\\node_modules\\vue-cli-plugin-apollo\\index.js',
    'projectDir\\node_modules\\@vue\\cli-service\\lib\\Service.js',
    'projectDir\\node_modules\\@vue\\cli-service\\bin\\vue-cli-service.js'
  ]
}

Is it a bug?
If not, pls tell me how to config alias for apollo-server.

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

1 participant