在我的webpack.config.js
中,以下代码有效:
resolve: {
alias: {
'@': path.join(__dirname, 'src'),
},
aliasFields: ['wepy'],
modules: ['node_modules']
},
// in .js file is work
import Api from '@/model/api'
但是当我修改它~~编译它找不到相应的模块。
resolve: {
alias: {
'~': path.join(__dirname, 'src'),
},
aliasFields: ['wepy'],
modules: ['node_modules']
},
// in .js file is not work
import Api from '~/model/api'
提示ReferenceError: Api is not defined