diff --git a/package.json b/package.json index 67ffd22..658b52b 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,10 @@ "@babel/runtime": "^7.14.6", "@types/jquery": "^3.5.6", "@types/node": "^16.4.1", + "@types/webpack": "^5.28.0", "babel-loader": "^8.2.2", + "ts-node": "^10.1.0", + "typescript": "^4.3.5", "webpack": "^4.46.0", "webpack-cli": "^4.7.2", "webpack-userscript": "^2.5.8" diff --git a/tsconfig.json b/tsconfig.json index c6e2017..5baaea7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -70,7 +70,8 @@ /* Advanced Options */ "skipLibCheck": true, /* Skip type checking of declaration files. */ - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "resolveJsonModule": true /* Disallow inconsistently-cased references to the same file. */ } } \ No newline at end of file diff --git a/webpack.config.js b/webpack.config.ts similarity index 89% rename from webpack.config.js rename to webpack.config.ts index 3a6709e..3f0be60 100644 --- a/webpack.config.js +++ b/webpack.config.ts @@ -1,7 +1,9 @@ -const path = require("path"); -const WebpackUserscript = require("webpack-userscript"); +import path from "path"; -const version = require("./package.json").version; +import WebpackUserscript from "webpack-userscript"; + +import {version} from "./package.json"; +import webpack from "webpack"; const header = { "name": "BetterNovelpia", @@ -23,7 +25,7 @@ const header = { "version": version }; -module.exports = { +const config: webpack.Configuration = { mode: "production", entry: "./src/index.ts", module: { @@ -66,4 +68,6 @@ module.exports = { headers: header }) ] -}; \ No newline at end of file +}; + +export default config; \ No newline at end of file