问题
Found a package that does replace, going to test with that.
Now if file.node gets replaced with file.min.js my question would be, how to not browserify this dependency i.e. not browserify file.min.js again ?
I've a package that has a browserified and minified
file.min.js
and its node version
file.node
it is used (as in modName = require("file.node") ) by many files.
but file.node cannot be browserified. don't ask why.
Many files depend upon modName module.
The file.min.js also contains modName such that
<script src='file,min.js' > exposes modName (umd for those who know);
Is there a way to browserify my pacakges main file main.js (which contains files that depend upon modName) such that I can replace the module file.node with file.min.js ;
Found this answer somewhat helpful
回答1:
Thanks to this guy's solution here
which might be a problem to others looking for an answer, this got solved.
Just doing
globalShim = require('browserify-global-shim').configure({
nodeModuleName: clientModuleName
}),
replaces,
nodeModule = require('nodeModuleName')
with
clientModuleName
in browser which is window.clientModuleName actually.
来源:https://stackoverflow.com/questions/34681058/how-to-browserify-a-file-that-includes-a-node-module-with-an-equivalent-client-v