mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2024-12-25 11:02:11 +03:00
fix webpack to handle node global functions
This commit is contained in:
parent
bfffd58683
commit
8f034bc078
@ -48,6 +48,14 @@ fn project() -> Project {
|
|||||||
"webpack.config.js".to_string(),
|
"webpack.config.js".to_string(),
|
||||||
r#"
|
r#"
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
|
let nodeModules = {};
|
||||||
|
fs.readdirSync('node_modules').filter(function(x) {
|
||||||
|
return ['.bin'].indexOf(x) === -1;
|
||||||
|
}).forEach(function(mod) {
|
||||||
|
nodeModules[mod] = 'commonjs ' + mod;
|
||||||
|
});
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
entry: './run.js',
|
entry: './run.js',
|
||||||
@ -69,7 +77,8 @@ fn project() -> Project {
|
|||||||
filename: 'bundle.js',
|
filename: 'bundle.js',
|
||||||
path: path.resolve(__dirname, '.')
|
path: path.resolve(__dirname, '.')
|
||||||
},
|
},
|
||||||
target: 'node'
|
target: 'node',
|
||||||
|
externals: nodeModules
|
||||||
};
|
};
|
||||||
"#.to_string(),
|
"#.to_string(),
|
||||||
),
|
),
|
||||||
|
Loading…
Reference in New Issue
Block a user