Add ~
as an import alias
This commit is contained in:
parent
50e7126c82
commit
6069b51f8b
6 changed files with 8 additions and 7 deletions
|
@ -1,7 +1,7 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { ErrorRenderer } from "/components/ErrorRenderer";
|
import { ErrorRenderer } from "~/components/ErrorRenderer";
|
||||||
import { ResponseRenderer } from "/components/ResponseRenderer";
|
import { ResponseRenderer } from "~/components/ResponseRenderer";
|
||||||
import { useWebService } from "/hooks/useWebService";
|
import { useWebService } from "~/hooks/useWebService";
|
||||||
|
|
||||||
export function App() {
|
export function App() {
|
||||||
const [response, error] = useWebService();
|
const [response, error] = useWebService();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { TResponse } from "/lib/response";
|
import { TResponse } from "~/lib/response";
|
||||||
|
|
||||||
export function ResponseRenderer({ response }: {response: TResponse}) {
|
export function ResponseRenderer({ response }: {response: TResponse}) {
|
||||||
const t = chrome.i18n.getMessage;
|
const t = chrome.i18n.getMessage;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { TResponse, Response } from "/lib/response";
|
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
|
import { TResponse, Response } from "~/lib/response";
|
||||||
|
|
||||||
type Maybe<T> = T | null;
|
type Maybe<T> = T | null;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import ReactDOM from "react-dom/client";
|
import ReactDOM from "react-dom/client";
|
||||||
import { App } from "/components/App";
|
import { App } from "~/components/App";
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", () => {
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
const el: HTMLElement = document.getElementById("root")!;
|
const el: HTMLElement = document.getElementById("root")!;
|
||||||
|
|
|
@ -12,6 +12,6 @@
|
||||||
"lib": [ "ES2020", "DOM" ],
|
"lib": [ "ES2020", "DOM" ],
|
||||||
|
|
||||||
"baseUrl": "src/",
|
"baseUrl": "src/",
|
||||||
"paths": { "*": ["js/*"] },
|
"paths": { "~/*": ["js/*"] },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ module.exports = {
|
||||||
path: path.resolve(__dirname, 'build')
|
path: path.resolve(__dirname, 'build')
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
|
alias: { '~': [path.resolve('src/js/')] },
|
||||||
roots: [path.resolve('src/js'), path.resolve('node_modules')],
|
roots: [path.resolve('src/js'), path.resolve('node_modules')],
|
||||||
modules: [path.resolve('src/js'), path.resolve('node_modules')],
|
modules: [path.resolve('src/js'), path.resolve('node_modules')],
|
||||||
extensions: ['.ts', '.tsx']
|
extensions: ['.ts', '.tsx']
|
||||||
|
|
Loading…
Reference in a new issue