Merge pull request #3517 from taralx/patch-1

MISC: make jQuery use explicit
This commit is contained in:
hydroflame 2022-04-19 22:31:30 -04:00 committed by GitHub
commit 4ea7a4d7a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 4 additions and 13 deletions

@ -1,5 +1,4 @@
module.exports = { module.exports = {
setupFiles: ["./jest.setup.js"],
moduleFileExtensions: ["ts", "tsx", "js", "jsx"], moduleFileExtensions: ["ts", "tsx", "js", "jsx"],
transform: { transform: {
"^.+\\.(js|jsx|ts|tsx)$": "babel-jest", "^.+\\.(js|jsx|ts|tsx)$": "babel-jest",

@ -1,2 +0,0 @@
import "regenerator-runtime/runtime";
global.$ = require("jquery");

@ -59,6 +59,7 @@
"@types/acorn": "^4.0.6", "@types/acorn": "^4.0.6",
"@types/escodegen": "^0.0.7", "@types/escodegen": "^0.0.7",
"@types/file-saver": "^2.0.3", "@types/file-saver": "^2.0.3",
"@types/jquery": "^3.5.14",
"@types/lodash": "^4.14.168", "@types/lodash": "^4.14.168",
"@types/numeral": "^2.0.2", "@types/numeral": "^2.0.2",
"@types/react": "^17.0.21", "@types/react": "^17.0.21",
@ -84,7 +85,6 @@
"prettier": "^2.3.2", "prettier": "^2.3.2",
"raw-loader": "^4.0.2", "raw-loader": "^4.0.2",
"react-refresh": "^0.10.0", "react-refresh": "^0.10.0",
"regenerator-runtime": "^0.13.9",
"source-map": "^0.7.3", "source-map": "^0.7.3",
"start-server-and-test": "^1.14.0", "start-server-and-test": "^1.14.0",
"typescript": "^4.2.4", "typescript": "^4.2.4",

@ -1,3 +1,4 @@
import $ from "jquery";
import { vsprintf, sprintf } from "sprintf-js"; import { vsprintf, sprintf } from "sprintf-js";
import { getRamCost } from "./Netscript/RamCostGenerator"; import { getRamCost } from "./Netscript/RamCostGenerator";

@ -1,3 +1,5 @@
import $ from "jquery";
import { ITerminal } from "../ITerminal"; import { ITerminal } from "../ITerminal";
import { IRouter } from "../../ui/Router"; import { IRouter } from "../../ui/Router";
import { IPlayer } from "../../PersonObjects/IPlayer"; import { IPlayer } from "../../PersonObjects/IPlayer";

@ -93,15 +93,6 @@ module.exports = (env, argv) => {
new webpack.DefinePlugin({ new webpack.DefinePlugin({
"process.env.NODE_ENV": isDevelopment ? '"development"' : '"production"', "process.env.NODE_ENV": isDevelopment ? '"development"' : '"production"',
}), }),
// http://stackoverflow.com/questions/29080148/expose-jquery-to-real-window-object-with-webpack
new webpack.ProvidePlugin({
// Automtically detect jQuery and $ as free var in modules
// and inject the jquery library
// This is required by many jquery plugins
jquery: "jquery",
jQuery: "jquery",
$: "jquery",
}),
new HtmlWebpackPlugin(htmlConfig), new HtmlWebpackPlugin(htmlConfig),
new MiniCssExtractPlugin({ new MiniCssExtractPlugin({
filename: "[name].css", filename: "[name].css",