Commit 31d03871 by lirandong

merge develop

parents 1f9681b8 6d03ea4b
const path = require('path')
// NOTE 在 sass 中通过别名(@ 或 ~)引用需要指定路径
const lessImporter = function (url) {
if (url[0] === '~' && url[1] !== '/') {
return {
file: path.resolve(__dirname, '..', 'node_modules', url.substr(1))
}
}
const reg = /^@styles\/(.*)/
return {
file: reg.test(url) ? path.resolve(__dirname, '..', 'src/styles', url.match(reg)[1]) : url
}
}
const config = {
projectName: 'taroDemo',
date: '2019-8-12',
......@@ -11,11 +27,11 @@ const config = {
outputRoot: 'dist',
alias: {
'@/': path.resolve(__dirname, '..', 'src'),
'@api/': path.resolve(__dirname, '..', 'src/api'),
'@pages/': path.resolve(__dirname, '..', 'src/pages'),
'@actions/': path.resolve(__dirname, '..', 'src/actions'),
'@constants/': path.resolve(__dirname, '..', 'src/constants'),
'@conpoments/': path.resolve(__dirname, '..', 'src/conpoments'),
'@/api': path.resolve(__dirname, '..', 'src/api'),
'@/pages': path.resolve(__dirname, '..', 'src/pages'),
'@/actions': path.resolve(__dirname, '..', 'src/actions'),
'@/constants': path.resolve(__dirname, '..', 'src/constants'),
'@/conpoments': path.resolve(__dirname, '..', 'src/conpoments'),
},
plugins: {
babel: {
......@@ -30,6 +46,9 @@ const config = {
'transform-class-properties',
'transform-object-rest-spread'
]
},
less: {
importer: lessImporter
}
},
defineConstants: {
......@@ -97,6 +116,9 @@ const config = {
generateScopedName: '[name]__[local]___[hash:base64:5]'
}
}
},
lessLoaderOption: {
importer: lessImporter
}
}
}
......
......@@ -4,7 +4,7 @@ import Taro, { Component, Config } from '@tarojs/taro'
import PageView from '@/constants/components/pageView'
import { View, Text, Input, ScrollView, Image } from '@tarojs/components'
import './less/index.less'
import api from '@/api'
import api from '@/api/index'
import token from '@/constants/token'
type PageStateProps = {}
......
......@@ -22,11 +22,11 @@
"typeRoots": ["node_modules/@types"],
"paths": {
"@/*": ["*"],
"@api/*": ["api/*"],
"@pages/*": ["pages/*"],
"@actions/*": ["actions/*"],
"@constants/*": ["constants/*"],
"@conpoments/*": ["conpoments/*"]
"@/api*": ["api/*"],
"@/pages*": ["pages/*"],
"@/actions*": ["actions/*"],
"@/constants*": ["constants/*"],
"@/conpoments*": ["conpoments/*"]
}
},
"exclude": ["node_modules", "dist"],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment