mirror of
https://github.com/vale981/tridactyl
synced 2025-03-04 17:11:40 -05:00
Configure absolute path resolution in ts and webpack
This lets us write imports like "@src/stuff" instead of "../../stuff"
This commit is contained in:
parent
dc064d322f
commit
ac114562b6
3 changed files with 15 additions and 4 deletions
|
@ -49,7 +49,7 @@
|
|||
},
|
||||
"jest": {
|
||||
"transform": {
|
||||
"^.+\\.tsx?$": "<rootDir>/node_modules/ts-jest/preprocessor.js"
|
||||
"^.+\\.tsx?$": "ts-jest"
|
||||
},
|
||||
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
|
||||
"moduleFileExtensions": [
|
||||
|
@ -58,7 +58,10 @@
|
|||
"js",
|
||||
"jsx",
|
||||
"json"
|
||||
]
|
||||
],
|
||||
"moduleNameMapper": {
|
||||
"@src/(.*)": "<rootDir>/src/$1"
|
||||
}
|
||||
},
|
||||
"author": "Colin Caine",
|
||||
"repository": {
|
||||
|
|
|
@ -8,12 +8,16 @@
|
|||
"target": "ES2017",
|
||||
"lib": ["ES2017","dom", "dom.iterable"],
|
||||
"typeRoots": ["node_modules/@types", "node_modules/web-ext-types/"],
|
||||
"alwaysStrict": true
|
||||
"alwaysStrict": true,
|
||||
"baseUrl": "src/",
|
||||
"paths": {
|
||||
"@src/*": ["*"],
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
"./src/**/*"
|
||||
],
|
||||
"exclude": [
|
||||
"./src/**/*.test.ts"
|
||||
"./src/**/*.test.ts"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
const { TsConfigPathsPlugin } = require('awesome-typescript-loader');
|
||||
const UglifyJSPlugin = require("uglifyjs-webpack-plugin")
|
||||
const CopyWebPackPlugin = require("copy-webpack-plugin")
|
||||
// const WebpackShellPlugin = require('webpack-shell-plugin')
|
||||
|
@ -22,6 +23,9 @@ module.exports = {
|
|||
resolve: {
|
||||
// Add '.ts' and '.tsx' as resolvable extensions.
|
||||
extensions: [".ts", ".tsx", ".js", ".json"],
|
||||
plugins: [
|
||||
new TsConfigPathsPlugin(),
|
||||
],
|
||||
},
|
||||
|
||||
module: {
|
||||
|
|
Loading…
Add table
Reference in a new issue