admin管理员组文章数量:1394774
Vue js 2.6.X, create with Vue-Cli 4.5.X using vue create name
I've added a jsconfig.json inside the root folder
"pilerOptions": {
"module": "monjs",
"target": "es6",
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"],
"@/modules/*": ["./src/store/modules/*"]
}
},
"exclude": ["node_modules", "dist"],
"include": ["src/**/*"]
}
the @ alias works. I can do @/store/modules/...
the one I've added
@/modules/*
won't work
This dependency was not found:
* @/modules/... in in ./node_modules/cache-loader/dist/cjs...
any idea on how I can resolve this? I've checked several sources, none seem to take vue js and vue-cli setup into account....
I also think that @/* is a vue-cli default setup...so adding it maybe pointless as is
Vue js 2.6.X, create with Vue-Cli 4.5.X using vue create name
I've added a jsconfig.json inside the root folder
"pilerOptions": {
"module": "monjs",
"target": "es6",
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"],
"@/modules/*": ["./src/store/modules/*"]
}
},
"exclude": ["node_modules", "dist"],
"include": ["src/**/*"]
}
the @ alias works. I can do @/store/modules/...
the one I've added
@/modules/*
won't work
This dependency was not found:
* @/modules/... in in ./node_modules/cache-loader/dist/cjs...
any idea on how I can resolve this? I've checked several sources, none seem to take vue js and vue-cli setup into account....
I also think that @/* is a vue-cli default setup...so adding it maybe pointless as is
Share Improve this question asked Sep 10, 2020 at 10:37 Liad GorenLiad Goren 3192 gold badges5 silver badges23 bronze badges2 Answers
Reset to default 3What have worked for me is also adding those alias in the webpack configuration in the vue.config.js
configureWebpack: {
resolve: {
alias: {
'@': path.resolve(__dirname, vueSrc),
'@modules': path.resolve(__dirname, vueSrc + 'store/modules')
},
extensions: ['.js', '.vue', '.json']
}
}
Note also that i used directly @modules
and not @/modules
which would match both, try inverting the order in case something like first match is actevated, but i think it is longest match policy via webpack
Try using
"@@/*":["./src/store/modules/*"]
and in your code use
import object from "@@/module_name";
will look for ./src/store/modules/module_name
本文标签: javascriptset jsconfigjson in a VueJS projectStack Overflow
版权声明:本文标题:javascript - set jsconfig.json in a VueJS project - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744102301a2590921.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论