Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add browser field to package.json's of modules with browser builds #921

Merged
merged 4 commits into from
Oct 21, 2020
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/block/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist"
"dist",
"dist.browser"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dist.browser fields were missing here, added these in 4f33ced

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah!!! Good catch!

],
"browser": "dist.browser/index.js",
"scripts": {
"build": "ethereumjs-config-ts-build",
"prepublishOnly": "npm run test && npm run build",
Expand Down
4 changes: 3 additions & 1 deletion packages/blockchain/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist/**/*"
"dist",
"dist.browser"
],
"browser": "dist.browser/index.js",
"scripts": {
"prepublishOnly": "npm run lint && npm run test && npm run build",
"build": "ethereumjs-config-ts-build",
Expand Down
9 changes: 9 additions & 0 deletions packages/blockchain/tsconfig.browser.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "@ethereumjs/config-typescript/tsconfig.browser.json",
"include": ["src/**/*.ts"],
"compilerOptions": {
"outDir": "./dist.browser",
"types": ["node"],
"typeRoots": ["node_modules/@types"]
}
}
4 changes: 3 additions & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist"
"dist",
"dist.browser"
],
"browser": "dist.browser/index.js",
"scripts": {
"build": "ethereumjs-config-ts-build",
"prepublishOnly": "npm run test && npm run build",
Expand Down
2 changes: 1 addition & 1 deletion packages/common/tsconfig.browser.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": "@ethereumjs/config-typescript/tsconfig.browser.json",
"include": ["src/**/*.ts"],
"include": ["src/**/*.ts", "src/**/*.json"],
Copy link
Contributor Author

@cgewecke cgewecke Oct 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These jsons were accidentally missing from the tsc browser config.

The errors looked like:

20 10 2020 15:04:25.170:ERROR [framework.browserify]: bundle error
20 10 2020 15:04:25.172:ERROR [framework.browserify]: Error: Can't walk dependency graph: Cannot find 
module './mainnet.json' from '/ethereumjs-vm/packages/common/dist.browser/chains/index.js'
    required by /ethereumjs-vm/packages/common/dist.browser/chains/index.js

...and the stack trace shows karma/browserfiy pulling files from dist.browser so that's 👍 .

"compilerOptions": {
"outDir": "./dist.browser"
}
Expand Down
4 changes: 3 additions & 1 deletion packages/ethash/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist"
"dist",
"dist.browser"
],
"browser": "dist.browser/index.js",
"scripts": {
"build": "ethereumjs-config-ts-build",
"tsc": "ethereumjs-config-tsc",
Expand Down
4 changes: 3 additions & 1 deletion packages/tx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist"
"dist",
"dist.browser"
],
"browser": "dist.browser/index.js",
"scripts": {
"build": "ethereumjs-config-ts-build",
"prepublishOnly": "npm run test && npm run build",
Expand Down
4 changes: 3 additions & 1 deletion packages/vm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist/**/*"
"dist",
"dist.browser"
],
"browser": "dist.browser/index.js",
"scripts": {
"build": "ethereumjs-config-ts-build",
"build:benchmarks": "npm run build && tsc -p tsconfig.benchmarks.json",
Expand Down
8 changes: 8 additions & 0 deletions packages/vm/tsconfig.browser.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "@ethereumjs/config-typescript/tsconfig.browser.json",
"include": ["lib/**/*.ts"],
"compilerOptions": {
"outDir": "./dist.browser",
"resolveJsonModule": true
}
}