Skip to content

Commit

Permalink
fixed fs issue
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielJDufour committed Apr 22, 2021
1 parent 428711f commit 4edc7a9
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 33 deletions.
34 changes: 17 additions & 17 deletions dist/georaster.browser.bundle.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/georaster.browser.bundle.min.js

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions dist/georaster.bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/georaster.bundle.min.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "georaster",
"version": "1.5.1",
"version": "1.5.2",
"description": "Wrapper around Georeferenced Rasters like GeoTIFF, NetCDF, JPG, and PNG that provides a standard interface",
"main": "dist/georaster.bundle.min.js",
"browser": "./dist/georaster.browser.bundle.min.js",
Expand All @@ -9,6 +9,7 @@
"analyze": "ANALYZE_GEORASTER_BUNDLE=true npm run build",
"clean": "rm -f ./dist/*",
"eslint": "node ./node_modules/eslint/bin/eslint.js src",
"lint": "npm run eslint",
"fix": "node ./node_modules/eslint/bin/eslint.js src --fix",
"test": "npm run test-dev",
"test-all": "npm run test-dev && npm run test-prod",
Expand Down Expand Up @@ -63,6 +64,7 @@
"eslint": "^5.7.0",
"eslint-config-google": "^0.11.0",
"mocha": "^6.2.0",
"null-loader": "^4.0.1",
"threads-plugin": "^1.3.1",
"webpack": "^4.12.0",
"webpack-bundle-analyzer": "^3.6.0",
Expand Down
14 changes: 8 additions & 6 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,16 @@ module.exports = (env, argv) => {
}));
}

const externals = {
'fs': 'fs'
};
// because don't want node-fetch in bundle meant for web
if (target === 'web') externals['node-fetch'] = 'node-fetch';
const externals = {};

// because threads can look for this
if (target === 'node') externals['tiny-worker'] = 'tiny-worker';
externals['txml'] = 'txml';

const node = {};
// neutralize import 'threads/register' in geotiff.js
node['threads/register'] = 'empty';

// can't access fs on the web
if (target === 'web') node['fs'] = 'empty';

Expand Down Expand Up @@ -73,7 +71,11 @@ module.exports = (env, argv) => {
},
},
},
],
target === "web" && {
test: path.resolve(__dirname, 'node_modules/node-fetch/browser.js'),
use: 'null-loader'
}
].filter(Boolean),
},
node,
externals,
Expand Down

0 comments on commit 4edc7a9

Please sign in to comment.