Support @-paths

This commit is contained in:
Aarni Halinen
2020-07-08 14:16:44 +03:00
parent 3f5dbfb674
commit 6af5969734
5 changed files with 95 additions and 16 deletions
+3 -1
View File
@@ -1,5 +1,6 @@
// Shared config (dev and prod) // Shared config (dev and prod)
const {resolve} = require("path"); const {resolve} = require("path");
const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin");
const {CheckerPlugin} = require("awesome-typescript-loader"); const {CheckerPlugin} = require("awesome-typescript-loader");
const StyleLintPlugin = require("stylelint-webpack-plugin"); const StyleLintPlugin = require("stylelint-webpack-plugin");
const webpack = require('webpack'); const webpack = require('webpack');
@@ -12,7 +13,8 @@ module.exports = function (env, argv) {
}; };
config.resolve = { config.resolve = {
extensions: [".ts", ".tsx", ".js", ".jsx"] extensions: [".ts", ".tsx", ".js", ".jsx"],
plugins: [new TsconfigPathsPlugin()]
}; };
config.context = resolve(__dirname, "../../src"); config.context = resolve(__dirname, "../../src");
config.module = { config.module = {
+46
View File
@@ -833,6 +833,12 @@
"integrity": "sha512-Il2DtDVRGDcqjDtE+rF8iqg1CArehSK84HZJCT7AMITlyXRBpuPhqGLDQMowraqqu1coEaimg4ZOqggt6L6L+A==", "integrity": "sha512-Il2DtDVRGDcqjDtE+rF8iqg1CArehSK84HZJCT7AMITlyXRBpuPhqGLDQMowraqqu1coEaimg4ZOqggt6L6L+A==",
"dev": true "dev": true
}, },
"@types/json5": {
"version": "0.0.29",
"resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
"integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=",
"dev": true
},
"@types/lodash": { "@types/lodash": {
"version": "4.14.146", "version": "4.14.146",
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.146.tgz", "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.146.tgz",
@@ -20330,6 +20336,46 @@
"utf8-byte-length": "^1.0.1" "utf8-byte-length": "^1.0.1"
} }
}, },
"tsconfig-paths": {
"version": "3.9.0",
"resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz",
"integrity": "sha512-dRcuzokWhajtZWkQsDVKbWyY+jgcLC5sqJhg2PSgf4ZkH2aHPvaOY8YWGhmjb68b5qqTfasSsDO9k7RUiEmZAw==",
"dev": true,
"requires": {
"@types/json5": "^0.0.29",
"json5": "^1.0.1",
"minimist": "^1.2.0",
"strip-bom": "^3.0.0"
},
"dependencies": {
"json5": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz",
"integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==",
"dev": true,
"requires": {
"minimist": "^1.2.0"
}
},
"minimist": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
"dev": true
}
}
},
"tsconfig-paths-webpack-plugin": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/tsconfig-paths-webpack-plugin/-/tsconfig-paths-webpack-plugin-3.2.0.tgz",
"integrity": "sha512-S/gOOPOkV8rIL4LurZ1vUdYCVgo15iX9ZMJ6wx6w2OgcpT/G4wMyHB6WM+xheSqGMrWKuxFul+aXpCju3wmj/g==",
"dev": true,
"requires": {
"chalk": "^2.3.0",
"enhanced-resolve": "^4.0.0",
"tsconfig-paths": "^3.4.0"
}
},
"tslib": { "tslib": {
"version": "1.9.3", "version": "1.9.3",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz",
+1
View File
@@ -105,6 +105,7 @@
"stylelint-webpack-plugin": "1.0.3", "stylelint-webpack-plugin": "1.0.3",
"testcafe": "1.6.1", "testcafe": "1.6.1",
"testcafe-react-selectors": "2.1.0", "testcafe-react-selectors": "2.1.0",
"tsconfig-paths-webpack-plugin": "3.2.0",
"typescript": "3.9.5", "typescript": "3.9.5",
"uglifyjs-webpack-plugin": "1.3.0", "uglifyjs-webpack-plugin": "1.3.0",
"webpack": "4.41.2", "webpack": "4.41.2",
+14 -14
View File
@@ -1,21 +1,21 @@
import React from "react"; import React from "react";
import "./FrontPage.scss"; import "./FrontPage.scss";
import appStore from "../../stores/AppStore"; import appStore from "@stores/AppStore";
import Card from "../../components/Card"; import Card from "@components/Card";
import { Event, getEvents } from "../../models/Event"; import { Event, getEvents } from "@models/Event";
import { Post, getFeed } from "../../models/Feed"; import { Post, getFeed } from "@models/Feed";
import { StaticContext } from "../../server/StaticContext"; import { StaticContext } from "@server/StaticContext";
import PageSection from "../../components/PageSection"; import PageSection from "@components/PageSection";
import PageLink from "../../components/PageLink/PageLink"; import PageLink from "@components/PageLink/PageLink";
import HeroMainSection from "../../components/Hero/HeroMainSection/HeroMainSection"; import HeroMainSection from "@components/Hero/HeroMainSection/HeroMainSection";
import HeroAsideSection from "../../components/Hero/HeroAsideSection/HeroAsideSection"; import HeroAsideSection from "@components/Hero/HeroAsideSection/HeroAsideSection";
import Button, { ButtonType } from "../../components/Button"; import Button, { ButtonType } from "@components/Button";
import Ribbon from "../../components/Ribbon"; import Ribbon from "@components/Ribbon";
import SponsorReel from "../../components/SponsorReel"; import SponsorReel from "@components/SponsorReel";
import HeroAsideItem from "../../components/Hero/HeroAsideItem/HeroAsideItem"; import HeroAsideItem from "@components/Hero/HeroAsideItem/HeroAsideItem";
import TextAnchor from "../../components/TextAnchor"; import TextAnchor from "@components/TextAnchor";
interface FrontPageProps { interface FrontPageProps {
staticContext: StaticContext; staticContext: StaticContext;
+31 -1
View File
@@ -18,7 +18,37 @@
"types": [ "types": [
"node", "node",
"jest" "jest"
] ],
"baseUrl": "./",
"paths": {
"@assets/*": [
"src/assets/*"
],
"@client/*": [
"src/client/*"
],
"@components/*": [
"src/components/*"
],
"@models/*": [
"src/models/*"
],
"@pages/*": [
"src/pages/*"
],
"@server/*": [
"src/server/*"
],
"@stores/*": [
"src/stores/*"
],
"@theme/*": [
"src/theme/*"
],
"@views/*": [
"src/views/*"
],
},
}, },
"include": [ "include": [
"./src/**/*", "./src/**/*",