From 8f034bc078cf5f26f003dff7367600975a1a7718 Mon Sep 17 00:00:00 2001 From: Sendil Kumar Date: Tue, 3 Jul 2018 18:14:30 +0200 Subject: [PATCH] fix webpack to handle node global functions --- tests/all/main.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/all/main.rs b/tests/all/main.rs index c7c872ff9..d4b814b89 100644 --- a/tests/all/main.rs +++ b/tests/all/main.rs @@ -48,6 +48,14 @@ fn project() -> Project { "webpack.config.js".to_string(), r#" 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 = { entry: './run.js', @@ -69,7 +77,8 @@ fn project() -> Project { filename: 'bundle.js', path: path.resolve(__dirname, '.') }, - target: 'node' + target: 'node', + externals: nodeModules }; "#.to_string(), ),