2019-12-08 04:02:22 +08:00
|
|
|
const path = require('path')
|
2019-12-08 05:23:49 +08:00
|
|
|
const globby = require('globby')
|
2019-12-08 04:02:22 +08:00
|
|
|
|
|
|
|
module.exports = function (api) {
|
|
|
|
api.chainWebpack(config => {
|
|
|
|
config.resolve.extensions
|
|
|
|
.add('.ts')
|
2019-12-08 07:16:44 +08:00
|
|
|
|
|
|
|
config.module
|
|
|
|
.rule('typescript')
|
|
|
|
.test(/\.tsx?$/)
|
|
|
|
.use()
|
|
|
|
.loader('ts-loader')
|
2020-04-17 01:13:21 +08:00
|
|
|
.options({ appendTsSuffixTo: [/\.vue$/] })
|
|
|
|
|
|
|
|
config.module
|
|
|
|
.rule('jsx')
|
|
|
|
.test(/\.jsx?$/)
|
|
|
|
.use()
|
|
|
|
.loader('babel-loader')
|
2020-04-22 04:11:57 +08:00
|
|
|
|
|
|
|
globby.sync('../packages/*', { onlyDirectories: true })
|
|
|
|
.map(name => name.replace('../packages/', ''))
|
2019-12-08 05:23:49 +08:00
|
|
|
.forEach(name => {
|
|
|
|
config.resolve.alias
|
2020-04-22 04:11:57 +08:00
|
|
|
.set(`@tiptap/${name}`, path.resolve(`../packages/${name}`))
|
2019-12-08 05:23:49 +08:00
|
|
|
})
|
2019-12-08 04:02:22 +08:00
|
|
|
})
|
|
|
|
}
|