Improve: add path alias

This commit is contained in:
jas0ncn 2018-09-02 16:09:42 +08:00
parent 9d5268107e
commit acaee8c63a
3 changed files with 23 additions and 3 deletions

View File

@ -1,6 +1,6 @@
// shared config (dev and prod)
const { resolve } = require('path')
const { CheckerPlugin } = require('awesome-typescript-loader')
const { CheckerPlugin, TsConfigPathsPlugin } = require('awesome-typescript-loader')
const StyleLintPlugin = require('stylelint-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
@ -53,4 +53,10 @@ module.exports = {
performance: {
hints: false,
},
resolve: {
extensions: ['.jsx', '.js', '.tsx', '.ts'],
plugins: [
new TsConfigPathsPlugin()
]
},
}

View File

@ -1,5 +1,5 @@
import renderApp from './render'
import { isClashX, setupJsBridge } from './lib/jsBridge'
import { isClashX, setupJsBridge } from '@lib/jsBridge'
/**
* Global entry

View File

@ -7,7 +7,21 @@
"module": "commonjs",
"target": "es5",
"jsx": "react",
"lib": ["es5", "es6", "dom"]
"lib": ["es5", "es6", "dom"],
"experimentalDecorators": true,
"baseUrl": ".",
"paths": {
"@lib": ["src/libs"],
"@lib/*": ["src/lib/*"],
"@components": ["src/components"],
"@components/*": ["src/components/*"],
"@containers": ["src/containers"],
"@containers/*": ["src/containers/*"],
"@models": ["src/models"],
"@models/*": ["src/models/*"],
"@stores": ["src/stores"],
"@stores/*": ["src/stores/*"]
}
},
"include": [
"./src/**/*"