Skip to content

Commit

Permalink
hopefully fixed loading on observablehq
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielJDufour committed Apr 23, 2021
1 parent 01cd557 commit fb2c0e6
Show file tree
Hide file tree
Showing 7 changed files with 304 additions and 65 deletions.
47 changes: 29 additions & 18 deletions dist/georaster.browser.bundle.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/georaster.browser.bundle.min.js

Large diffs are not rendered by default.

279 changes: 249 additions & 30 deletions dist/georaster.bundle.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"babel-preset-env": "^1.7.0",
"browserify": "^14.5.0",
"chai": "^4.1.0",
"d3-require": "^1.2.4",
"eslint": "^5.7.0",
"eslint-config-google": "^0.11.0",
"mocha": "^6.2.0",
Expand Down
16 changes: 16 additions & 0 deletions test/test.d3-require.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<script src="../node_modules/d3-require/dist/d3-require.min.js"></script>
</head>
<body>
<script>
const myRequire = d3.requireFrom(async name => {
return `../dist/${name}`;
});
myRequire("georaster.browser.bundle.min.js").then(parseGeoraster => {
console.log("required:", parseGeoraster);
});
</script>
</body>
</html>
18 changes: 5 additions & 13 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ module.exports = (env, argv) => {
const targetFileNamePart = target === 'node' ? '' : '.browser';

const plugins = [
new webpack.ProvidePlugin({
'txml': 'txml'
}),
new ThreadsPlugin()
];
if (process.env.ANALYZE_GEORASTER_BUNDLE) {
Expand All @@ -21,12 +18,8 @@ module.exports = (env, argv) => {
}

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';

Expand All @@ -44,11 +37,6 @@ module.exports = (env, argv) => {
library: 'GeoRaster',
libraryTarget: 'umd',
},
resolve: {
alias: {
'txml': path.resolve(__dirname, './node_modules/txml/tXml.min.js')
}
},
module: {
rules: [
{
Expand All @@ -74,6 +62,10 @@ module.exports = (env, argv) => {
target === "web" && {
test: path.resolve(__dirname, 'node_modules/node-fetch/browser.js'),
use: 'null-loader'
},
target === "web" && {
test: path.resolve(__dirname, 'node_modules/tiny-worker/lib/index.js'),
use: 'null-loader'
}
].filter(Boolean),
},
Expand Down

0 comments on commit fb2c0e6

Please sign in to comment.