mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-03-16 10:10:52 +00:00
add some comments
This commit is contained in:
parent
8f034bc078
commit
99ca230bdb
@ -49,13 +49,23 @@ fn project() -> Project {
|
||||
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;
|
||||
});
|
||||
|
||||
// Webpack bundles the modules from node_modules.
|
||||
// For node target, we will not have `fs` module
|
||||
// inside the `node_modules` folder.
|
||||
// This reads the directories in `node_modules`
|
||||
// and give that to externals and webpack ignores
|
||||
// to bundle the modules listed as external.
|
||||
fs.readdirSync('node_modules')
|
||||
.filter(module => ['.bin'].indexOf(module) === -1)
|
||||
.forEach(mod => {
|
||||
// External however,expects browser environment.
|
||||
// To make it work in `node` target we
|
||||
// prefix commonjs here.
|
||||
nodeModules[mod] = 'commonjs ' + mod;
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
entry: './run.js',
|
||||
|
Loading…
x
Reference in New Issue
Block a user