diff --git a/etc/tsconfig.json b/etc/tsconfig.json index 0c706b6..546abc6 100644 --- a/etc/tsconfig.json +++ b/etc/tsconfig.json @@ -1,4 +1,10 @@ { + "include": [ + "../src/js/typings/globals.d.ts", + "../src/**/*.ts", + "../src/**/*.tsx", + ], + "exclude": ["../node_modules"], "compilerOptions": { "strict": true, "module": "commonjs", @@ -7,7 +13,7 @@ "esModuleInterop": true, "jsx": "react-jsx", "lib": [ "ES2020", "DOM" ], - "baseUrl": "src/", + "baseUrl": "../src/", "paths": { "~/*": ["js/*"] }, "types": ["node", "jest", "@testing-library/jest-dom", "@types/chrome"] } diff --git a/etc/webpack.common.js b/etc/webpack.common.js index c37cf5f..80410ea 100644 --- a/etc/webpack.common.js +++ b/etc/webpack.common.js @@ -1,5 +1,6 @@ const path = require("path"); const process = require("process"); +const webpack = require("webpack"); const CopyPlugin = require("copy-webpack-plugin"); const { CleanWebpackPlugin } = require("clean-webpack-plugin"); @@ -9,17 +10,16 @@ module.exports = { }, output: { filename: "js/[name].js", - path: path.resolve(__dirname, "build") + path: path.resolve(__dirname, "..", "build") }, resolve: { alias: { - "~": [path.resolve("src/js/")], + "~": [path.resolve(__dirname, "..", "src", "js")], "react": "preact/compat", "react-dom": "preact/compat", "react/jsx-runtime": "preact/jsx-runtime", }, - roots: [path.resolve("src/js"), path.resolve("node_modules")], - modules: [path.resolve("src/js"), path.resolve("node_modules")], + modules: [path.resolve(__dirname, "..", "node_modules")], extensions: [".ts", ".tsx"] }, module: { @@ -47,5 +47,8 @@ module.exports = { ], }), new CleanWebpackPlugin(), + new webpack.ProvidePlugin({ + React: ['preact/compat'] + }), ], }