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')
|
|
|
|
.options({ appendTsSuffixTo: [/\.vue$/] });
|
2019-12-08 05:23:49 +08:00
|
|
|
|
|
|
|
globby.sync('./packages/*', { onlyDirectories: true })
|
2020-03-30 16:42:59 +08:00
|
|
|
.map(name => name.replace('./packages/', ''))
|
2019-12-08 05:23:49 +08:00
|
|
|
.forEach(name => {
|
|
|
|
config.resolve.alias
|
2020-03-30 16:42:59 +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
|
|
|
})
|
|
|
|
}
|