Skip to content

Commit

Permalink
inject global.process to emscripten glue code
Browse files Browse the repository at this point in the history
  • Loading branch information
toyobayashi committed Oct 19, 2020
1 parent b9ebf1c commit 11c5d9f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
6 changes: 3 additions & 3 deletions tsgo.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const CopyWebpackPlugin = require('copy-webpack-plugin')
const path = require('path')
const webpack = require('webpack')
// const webpack = require('webpack')

module.exports = {
entry: 'lib/esm-modern/index.js',
Expand All @@ -9,7 +9,7 @@ module.exports = {
},
bundler: ['webpack'],
configureWebpack (config) {
const webpackVesion = Number(webpack.version.charAt(0))
/* const webpackVesion = Number(webpack.version.charAt(0))
if (webpackVesion > 4) {
config.node = false
config.resolve.fallback = {
Expand All @@ -22,7 +22,7 @@ module.exports = {
__filename: false,
process: false
}
}
} */
config.resolve.alias = {
'@tybys/binreader': '@tybys/binreader/lib/esm-modern/index.js'
}
Expand Down
11 changes: 6 additions & 5 deletions wasm/pre.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,17 @@
return m;
}
var name = 'wzWasm';
var _process = root && root.process;
if(typeof exports === 'object' && typeof module === 'object') {
module.exports = makeESModule(factory(require('@tybys/native-require').tryGetRequireFunction()));
module.exports = makeESModule(factory(require('@tybys/native-require').tryGetRequireFunction(), _process));
} else if(typeof define === 'function' && define.amd) {
define(['@tybys/native-require'], function (nr) {
return makeESModule(factory(nr.tryGetRequireFunction()));
return makeESModule(factory(nr.tryGetRequireFunction(), _process));
});
} else if(typeof exports === 'object') {
exports[name] = makeESModule(factory(require('@tybys/native-require').tryGetRequireFunction()));
exports[name] = makeESModule(factory(require('@tybys/native-require').tryGetRequireFunction(), _process));
} else {
root[name] = factory(nr.tryGetRequireFunction());
root[name] = factory(nr.tryGetRequireFunction(), _process);
}
})((function (defaultValue) {
var g;
Expand All @@ -37,4 +38,4 @@
}

return g || defaultValue;
})(this), function (require) {
})(this), function (require, process) {

0 comments on commit 11c5d9f

Please sign in to comment.