Skip to content
This repository has been archived by the owner on Oct 7, 2022. It is now read-only.

Switch wallet tsconfig to use esnext module #614

Merged
merged 4 commits into from
Dec 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 12 additions & 2 deletions packages/wallet/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,18 @@ module.exports = function(webpackEnv) {
PnpWebpackPlugin.moduleLoader(module)
]
},

// Webpack has some issue with ts-loader, transpileOnly, and esnext
// https://github.com/TypeStrong/ts-loader/issues/751#issuecomment-376318718
stats: {
warningsFilter: /export .* was not found in/,
},

module: {
strictExportPresence: true,
// Because of the issue above w.r.t. ts-loader warnings, this must be set to false
// otherwise those meaningless warnings would break the compilation
strictExportPresence: false,

rules: [
// Disable require.ensure as it's not a standard language feature.
{
Expand Down Expand Up @@ -406,7 +416,7 @@ module.exports = function(webpackEnv) {
// its runtime that would otherwise be processed through "file" loader.
// Also exclude `html` and `json` extensions so they get processed
// by webpacks internal loaders.
exclude: [/\.(js|mjs|jsx|ts|tsx)$/, /\.html$/, /\.json$/],
exclude: [/\.(js|mjs|jsx|ts|tsx)$/, /\.wasm$/, /\.html$/, /\.json$/],
options: {
name: "static/media/[name].[hash:8].[ext]"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/wallet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"test:ci": "yarn test:ci:contracts && yarn test:ci:app",
"test:contracts": "npx jest --runInBand -c ./config/jest/jest.contracts.config.js --detectOpenHandles --bail",
"test": "run-s 'test:app --all' 'test:contracts --all'",
"test:integration": "npx ts-node ./puppeteer/funding.ts"
"test:integration": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' npx ts-node ./puppeteer/funding.ts"
},
"dependencies": {
"@firebase/app-types": "^0.3.2",
Expand Down
18 changes: 9 additions & 9 deletions packages/wallet/src/json-rpc-validation/validator.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import Ajv, {ErrorObject} from "ajv";
import * as requestSchema from "./schema/request.json";
import * as responseSchema from "./schema/response.json";
import * as createChannelSchema from "./schema/create-channel.json";
import * as getAddressSchema from "./schema/get-address.json";
import * as joinChannelSchema from "./schema/join-channel.json";
import * as updateChannelSchema from "./schema/update-channel.json";
import * as definitionsSchema from "./schema/definitions.json";
import * as pushMessageSchema from "./schema/push-message.json";
import * as notifSchema from "./schema/notification.json";
import requestSchema from "./schema/request.json";
import responseSchema from "./schema/response.json";
import createChannelSchema from "./schema/create-channel.json";
import getAddressSchema from "./schema/get-address.json";
import joinChannelSchema from "./schema/join-channel.json";
import updateChannelSchema from "./schema/update-channel.json";
import definitionsSchema from "./schema/definitions.json";
import pushMessageSchema from "./schema/push-message.json";
import notifSchema from "./schema/notification.json";

export interface ValidationResult {
isValid: boolean;
Expand Down
6 changes: 5 additions & 1 deletion packages/wallet/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
"baseUrl": ".",
"composite": true,
"outDir": "lib",
"module": "commonjs",

// esnext is required for TypeScript to recognize dynamic imports (which pure-evm must be)
// https://github.com/Microsoft/TypeScript/issues/16820
"module": "esnext",

"target": "es2015",
"lib": ["es6", "dom"],
"sourceMap": true,
Expand Down